diff dwt/internal/image/PngIdatChunk.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
line wrap: on
line diff
--- a/dwt/internal/image/PngIdatChunk.d	Fri Sep 12 13:53:21 2008 +0200
+++ b/dwt/internal/image/PngIdatChunk.d	Sun Sep 14 01:45:57 2008 +0200
@@ -7,19 +7,25 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ * Port to the D programming language:
+ *     Frank Benoit <benoit@tionex.de>
  *******************************************************************************/
-module dwt.internal.image;
+module dwt.internal.image.PngIdatChunk;
 
 
 import dwt.DWT;
+import dwt.internal.image.PngFileReadState;
+import dwt.internal.image.PngIhdrChunk;
+import dwt.internal.image.PngChunk;
+import dwt.dwthelper.utils;
 
 class PngIdatChunk : PngChunk {
 
-    static final int HEADER_BYTES_LENGTH = 2;
-    static final int ADLER_FIELD_LENGTH = 4;
-    static final int HEADER_BYTE1_DATA_OFFSET = DATA_OFFSET + 0;
-    static final int HEADER_BYTE2_DATA_OFFSET = DATA_OFFSET + 1;
-    static final int ADLER_DATA_OFFSET = DATA_OFFSET + 2; // plus variable compressed data length
+    static const int HEADER_BYTES_LENGTH = 2;
+    static const int ADLER_FIELD_LENGTH = 4;
+    static const int HEADER_BYTE1_DATA_OFFSET = DATA_OFFSET + 0;
+    static const int HEADER_BYTE2_DATA_OFFSET = DATA_OFFSET + 1;
+    static const int ADLER_DATA_OFFSET = DATA_OFFSET + 2; // plus variable compressed data length
 
 this(byte headerByte1, byte headerByte2, byte[] data, int adler) {
     super(data.length + HEADER_BYTES_LENGTH + ADLER_FIELD_LENGTH);
@@ -30,28 +36,28 @@
     setInt32(ADLER_DATA_OFFSET, adler);
     setCRC(computeCRC());
 }
-        
+
 this(byte[] reference) {
     super(reference);
 }
 
-int getChunkType() {
+override int getChunkType() {
     return CHUNK_IDAT;
 }
 
 /**
  * Answer whether the chunk is a valid IDAT chunk.
  */
-void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
+override void validate(PngFileReadState readState, PngIhdrChunk headerChunk) {
     if (!readState.readIHDR
         || (headerChunk.getMustHavePalette() && !readState.readPLTE)
-        || readState.readIEND) 
+        || readState.readIEND)
     {
         DWT.error(DWT.ERROR_INVALID_IMAGE);
     } else {
         readState.readIDAT = true;
     }
-    
+
     super.validate(readState, headerChunk);
 }