Mercurial > projects > dwt-mac
diff dwt/internal/image/JPEGQuantizationTable.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 |
line wrap: on
line diff
--- a/dwt/internal/image/JPEGQuantizationTable.d Fri Sep 12 13:53:21 2008 +0200 +++ b/dwt/internal/image/JPEGQuantizationTable.d Sun Sep 14 01:45:57 2008 +0200 @@ -7,12 +7,19 @@ * * 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.JPEGQuantizationTable; +import dwt.internal.image.LEDataInputStream; +import dwt.internal.image.JPEGVariableSizeSegment; +import dwt.internal.image.JPEGFileFormat; + +import dwt.dwthelper.System; final class JPEGQuantizationTable : JPEGVariableSizeSegment { - public static byte[] DefaultLuminanceQTable = { + public static byte[] DefaultLuminanceQTable = [ cast(byte)255, cast(byte)219, 0, 67, 0, 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, @@ -22,8 +29,8 @@ 24, 35, 55, 64, 81, 104, 113, 92, 49, 64, 78, 87, 103, 121, 120, 101, 72, 92, 95, 98, 112, 100, 103, 99 - }; - public static byte[] DefaultChrominanceQTable = { + ]; + public static byte[] DefaultChrominanceQTable = [ cast(byte)255, cast(byte)219, 0, 67, 1, 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, @@ -33,8 +40,8 @@ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99 - }; - + ]; + public this(byte[] reference) { super(reference); } @@ -84,7 +91,7 @@ } public int[][] getQuantizationTablesValues() { - int[][] values = new int[4][]; + int[][] values = new int[][](4); int valuesIndex = 0; int totalLength = getSegmentLength() - 2; int ofs = 4; @@ -106,14 +113,14 @@ totalLength -= 129; } if (valuesIndex >= values.length) { - int[][] newValues = new int[values.length + 4][]; + int[][] newValues = new int[][](values.length + 4); System.arraycopy(values, 0, newValues, 0, values.length); values = newValues; } values[valuesIndex] = qk; valuesIndex++; } - int[][] newValues = new int[valuesIndex][]; + int[][] newValues = new int[][](valuesIndex); System.arraycopy(values, 0, newValues, 0, valuesIndex); return newValues; } @@ -159,7 +166,7 @@ } } -public int signature() { +public override int signature() { return JPEGFileFormat.DQT; } }