Mercurial > projects > dwt-mac
comparison dwt/internal/image/LZWCodec.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 | e831403a80a9 |
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.LZWCodec; |
12 | 14 |
13 | 15 |
16 import dwt.internal.image.LZWNode; | |
17 import dwt.internal.image.LEDataInputStream; | |
18 import dwt.internal.image.LEDataOutputStream; | |
14 import dwt.DWT; | 19 import dwt.DWT; |
15 import dwt.graphics.ImageData; | 20 import dwt.graphics.ImageData; |
16 import dwt.graphics.ImageLoader; | 21 import dwt.graphics.ImageLoader; |
17 import dwt.graphics.ImageLoaderEvent; | 22 import dwt.graphics.ImageLoaderEvent; |
23 import dwt.dwthelper.utils; | |
24 | |
25 import tango.core.Exception; | |
18 | 26 |
19 final class LZWCodec { | 27 final class LZWCodec { |
20 int bitsPerPixel, blockSize, blockIndex, currentByte, bitsLeft, | 28 int bitsPerPixel, blockSize, blockIndex, currentByte, bitsLeft, |
21 codeSize, clearCode, endCode, newCodes, topSlot, currentSlot, | 29 codeSize, clearCode, endCode, newCodes, topSlot, currentSlot, |
22 imageWidth, imageHeight, imageX, imageY, pass, line, codeMask; | 30 imageWidth, imageHeight, imageX, imageY, pass, line, codeMask; |
26 LEDataInputStream inputStream; | 34 LEDataInputStream inputStream; |
27 LEDataOutputStream outputStream; | 35 LEDataOutputStream outputStream; |
28 ImageData image; | 36 ImageData image; |
29 ImageLoader loader; | 37 ImageLoader loader; |
30 bool interlaced; | 38 bool interlaced; |
31 static final int[] MASK_TABLE = new int[] { | 39 static final int[] MASK_TABLE = [ |
32 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, | 40 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, |
33 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF | 41 0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF |
34 }; | 42 ]; |
35 | 43 |
36 /** | 44 /** |
37 * Decode the input. | 45 * Decode the input. |
38 */ | 46 */ |
39 void decode() { | 47 void decode() { |