comparison dwt/internal/image/JPEGFixedSizeSegment.d @ 34:5123b17c98ef

Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sun, 14 Sep 2008 01:45:57 +0200
parents 1a8b3cb347e0
children
comparison
equal deleted inserted replaced
33:965ac0a77267 34:5123b17c98ef
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * IBM Corporation - initial API and implementation 9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
10 *******************************************************************************/ 12 *******************************************************************************/
11 module dwt.internal.image; 13 module dwt.internal.image.JPEGFixedSizeSegment;
12 14
13 15
14 import dwt.DWT; 16 import dwt.DWT;
17 import dwt.internal.image.JPEGSegment;
18 import dwt.internal.image.LEDataInputStream;
19
20 import tango.core.Exception;
21
15 22
16 abstract class JPEGFixedSizeSegment : JPEGSegment { 23 abstract class JPEGFixedSizeSegment : JPEGSegment {
17 24
18 public this() { 25 public this() {
19 reference = new byte[fixedSize()]; 26 reference = new byte[fixedSize()];
20 setSegmentMarker(signature()); 27 setSegmentMarker(signature());
21 } 28 }
22 29
23 public this(byte[] reference) { 30 public this(byte[] reference) {
24 super(reference); 31 super(reference);
25 } 32 }
26 33
27 public this(LEDataInputStream byteStream) { 34 public this(LEDataInputStream byteStream) {
28 reference = new byte[fixedSize()]; 35 reference = new byte[fixedSize()];
29 try { 36 try {
30 byteStream.read(reference); 37 byteStream.read(reference);
31 } catch (Exception e) { 38 } catch (Exception e) {
32 DWT.error(DWT.ERROR_IO, e); 39 DWT.error(DWT.ERROR_IO, e);
33 } 40 }
34 } 41 }
35 42
36 abstract public int fixedSize(); 43 abstract public int fixedSize();
37 44
38 public int getSegmentLength() { 45 public override int getSegmentLength() {
39 return fixedSize() - 2; 46 return fixedSize() - 2;
40 } 47 }
41 48
42 public void setSegmentLength(int length) { 49 public override void setSegmentLength(int length) {
43 } 50 }
44 } 51 }