You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2013/11/27 23:54:59 UTC

svn commit: r1546221 - /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java

Author: ebourg
Date: Wed Nov 27 22:54:59 2013
New Revision: 1546221

URL: http://svn.apache.org/r1546221
Log:
Use readable char values for the PNG constants

Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java?rev=1546221&r1=1546220&r2=1546221&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java Wed Nov 27 22:54:59 2013
@@ -23,69 +23,33 @@ public final class PngConstants {
 
     public static final int COMPRESSION_DEFLATE_INFLATE = 0;
 
-    public static final BinaryConstant IHDR_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 73, 72, 68, 82 });
-    public static final BinaryConstant PLTE_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 80, 76, 84, 69 });
-    public static final BinaryConstant TRNS_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 't', 'R', 'N', 'S'});
-    public static final BinaryConstant IEND_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 73, 69, 78, 68 });
-    public static final BinaryConstant IDAT_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 73, 68, 65, 84 });
-    public static final BinaryConstant iTXt_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { //
-            105, //
-                    84, //
-                    88, //
-                    116, //
-            });
-    public static final BinaryConstant tEXt_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { //
-            0x74, //
-                    0x45, //
-                    0x58, //
-                    0x74, //
-            });
-    public static final BinaryConstant zTXt_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { //
-            0x7A, //
-                    0x54, //
-                    0x58, //
-                    0x74, //
-            });
-    public static final BinaryConstant IPHYS_CHUNK_TYPE = new BinaryConstant(
-            new byte[] { 'p', 'H', 'Y', 's' });
-
-    public static final int IEND = BinaryFunctions.charsToQuad('I', 'E',
-            'N', 'D');
-    public static final int IHDR = BinaryFunctions.charsToQuad('I', 'H',
-            'D', 'R');
-    public static final int iCCP = BinaryFunctions.charsToQuad('i', 'C',
-            'C', 'P');
-    public static final int tEXt = BinaryFunctions.charsToQuad('t', 'E',
-            'X', 't');
-    public static final int zTXt = BinaryFunctions.charsToQuad('z', 'T',
-            'X', 't');
-    public static final int pHYs = BinaryFunctions.charsToQuad('p', 'H',
-            'Y', 's');
-    public static final int PLTE = BinaryFunctions.charsToQuad('P', 'L',
-            'T', 'E');
-    public static final int IDAT = BinaryFunctions.charsToQuad('I', 'D',
-            'A', 'T');
-    public static final int tRNS = BinaryFunctions.charsToQuad('t', 'R',
-            'N', 'S');
-    public static final int gAMA = BinaryFunctions.charsToQuad('g', 'A',
-            'M', 'A');
-    public static final int sRGB = BinaryFunctions.charsToQuad('s', 'R',
-            'G', 'B');
+    public static final BinaryConstant IHDR_CHUNK_TYPE = new BinaryConstant(new byte[] { 'I', 'H', 'D', 'R' });
+    public static final BinaryConstant PLTE_CHUNK_TYPE = new BinaryConstant(new byte[] { 'P', 'L', 'T', 'E' });
+    public static final BinaryConstant TRNS_CHUNK_TYPE = new BinaryConstant(new byte[] { 't', 'R', 'N', 'S' });
+    public static final BinaryConstant IEND_CHUNK_TYPE = new BinaryConstant(new byte[] { 'I', 'E', 'N', 'D' });
+    public static final BinaryConstant IDAT_CHUNK_TYPE = new BinaryConstant(new byte[] { 'I', 'D', 'A', 'T' });
+    public static final BinaryConstant iTXt_CHUNK_TYPE = new BinaryConstant(new byte[] { 'i', 'T', 'X', 't' });
+    public static final BinaryConstant tEXt_CHUNK_TYPE = new BinaryConstant(new byte[] { 't', 'E', 'X', 't' });
+    public static final BinaryConstant zTXt_CHUNK_TYPE = new BinaryConstant(new byte[] { 'z', 'T', 'X', 't' });
+    public static final BinaryConstant IPHYS_CHUNK_TYPE = new BinaryConstant(new byte[] { 'p', 'H', 'Y', 's' });
+
+    public static final int IEND = BinaryFunctions.charsToQuad('I', 'E', 'N', 'D');
+    public static final int IHDR = BinaryFunctions.charsToQuad('I', 'H', 'D', 'R');
+    public static final int iCCP = BinaryFunctions.charsToQuad('i', 'C', 'C', 'P');
+    public static final int tEXt = BinaryFunctions.charsToQuad('t', 'E', 'X', 't');
+    public static final int zTXt = BinaryFunctions.charsToQuad('z', 'T', 'X', 't');
+    public static final int pHYs = BinaryFunctions.charsToQuad('p', 'H', 'Y', 's');
+    public static final int PLTE = BinaryFunctions.charsToQuad('P', 'L', 'T', 'E');
+    public static final int IDAT = BinaryFunctions.charsToQuad('I', 'D', 'A', 'T');
+    public static final int tRNS = BinaryFunctions.charsToQuad('t', 'R', 'N', 'S');
+    public static final int gAMA = BinaryFunctions.charsToQuad('g', 'A', 'M', 'A');
+    public static final int sRGB = BinaryFunctions.charsToQuad('s', 'R', 'G', 'B');
 
     // XMP chunk type.
-    public static final int iTXt = BinaryFunctions.charsToQuad('i', 'T',
-            'X', 't');
+    public static final int iTXt = BinaryFunctions.charsToQuad('i', 'T', 'X', 't');
 
     public static final BinaryConstant PNG_SIGNATURE = new BinaryConstant(
-            new byte[] { (byte) 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, });
+            new byte[] { (byte) 0x89, 'P', 'N', 'G', '\r', '\n', 0x1A, '\n', });
 
     public static final String PARAM_KEY_PNG_BIT_DEPTH = "PNG_BIT_DEPTH";
     public static final String PARAM_KEY_PNG_FORCE_INDEXED_COLOR = "PNG_FORCE_INDEXED_COLOR";