Author: britter
Date: Sat Dec 27 19:32:38 2014
New Revision: 1648096

URL: http://svn.apache.org/r1648096
Log:
Replace color type constants with enum

Added:
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
      - copied, changed from r1648081, 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ColorType.java
Removed:
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ColorType.java
Modified:
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
    
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
    
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
 Sat Dec 27 19:32:38 2014
@@ -26,6 +26,30 @@ import java.util.List;
  * width, height, format, bit depth, etc.
  */
 public class ImageInfo {
+
+    public static enum ColorType {
+        BW("Black and White"),
+        GRAYSCALE("Grayscale"),
+        RGB("RGB"),
+        CMYK("CMYK"),
+        YCbCr("YCbCr"),
+        YCCK("YCCK"),
+        YCC("YCC"),
+        OTHER("Other"),
+        UNKNOWN("Unknown");
+
+        private String description;
+
+        ColorType(String description) {
+            this.description = description;
+        }
+
+        @Override
+        public String toString() {
+            return description;
+        }
+    }
+
     private final String formatDetails; // ie version
 
     private final int bitsPerPixel;
@@ -47,17 +71,7 @@ public class ImageInfo {
 
     private final boolean usesPalette;
 
-    public static final int COLOR_TYPE_BW = 0;
-    public static final int COLOR_TYPE_GRAYSCALE = 1;
-    public static final int COLOR_TYPE_RGB = 2;
-    public static final int COLOR_TYPE_CMYK = 3;
-    public static final int COLOR_TYPE_YCbCr = 4;
-    public static final int COLOR_TYPE_YCCK = 5;
-    public static final int COLOR_TYPE_YCC = 6;
-    public static final int COLOR_TYPE_OTHER = -1;
-    public static final int COLOR_TYPE_UNKNOWN = -2;
-
-    private final int colorType;
+    private final ColorType colorType;
 
     public static final String COMPRESSION_ALGORITHM_UNKNOWN = "Unknown";
     public static final String COMPRESSION_ALGORITHM_NONE = "None";
@@ -79,7 +93,7 @@ public class ImageInfo {
             final int physicalHeightDpi, final float physicalHeightInch,
             final int physicalWidthDpi, final float physicalWidthInch, final 
int width,
             final boolean progressive, final boolean transparent, final 
boolean usesPalette,
-            final int colorType, final String compressionAlgorithm) {
+            final ColorType colorType, final String compressionAlgorithm) {
         this.formatDetails = formatDetails;
 
         this.bitsPerPixel = bitsPerPixel;
@@ -239,47 +253,12 @@ public class ImageInfo {
     }
 
     /**
-     * Returns the color type of the image, as a constant (ie.
-     * ImageFormat.COLOR_TYPE_CMYK).
-     * 
-     * @see #getColorTypeDescription()
+     * Returns the {@link org.apache.commons.imaging.ImageInfo.ColorType} of 
the image.
      */
-    public int getColorType() {
+    public ColorType getColorType() {
         return colorType;
     }
 
-    /**
-     * Returns a description of the color type of the image.
-     * 
-     * @see #getColorType()
-     */
-    public String getColorTypeDescription() {
-        switch (colorType) {
-        case COLOR_TYPE_BW:
-            return "Black and White";
-        case COLOR_TYPE_GRAYSCALE:
-            return "Grayscale";
-        case COLOR_TYPE_RGB:
-            return "RGB";
-        case COLOR_TYPE_CMYK:
-            return "CMYK";
-        case COLOR_TYPE_YCbCr:
-            return "YCbCr";
-        case COLOR_TYPE_YCCK:
-            return "YCCK";
-        case COLOR_TYPE_YCC:
-            return "YCC";
-        case COLOR_TYPE_OTHER:
-            return "Other";
-        case COLOR_TYPE_UNKNOWN:
-            return "Unknown";
-
-        default:
-            return "Unknown";
-        }
-
-    }
-
     public void dump() {
         System.out.print(toString());
     }
@@ -323,7 +302,7 @@ public class ImageInfo {
         pw.println("Is Progressive: " + progressive);
         pw.println("Is Transparent: " + transparent);
 
-        pw.println("Color Type: " + getColorTypeDescription());
+        pw.println("Color Type: " + colorType.toString());
         pw.println("Uses Palette: " + usesPalette);
 
         pw.flush();

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -616,7 +616,7 @@ public class BmpImageParser extends Imag
         final boolean transparent = false;
 
         final boolean usesPalette = colorTable != null;
-        final int colorType = ImageInfo.COLOR_TYPE_RGB;
+        final ImageInfo.ColorType colorType = ImageInfo.ColorType.RGB;
         final String compressionAlgorithm = 
ImageInfo.COMPRESSION_ALGORITHM_RLE;
 
         return new ImageInfo(formatDetails, bitsPerPixel, comments,

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -569,7 +569,7 @@ public class GifImageParser extends Imag
         }
 
         final boolean usesPalette = true;
-        final int colorType = ImageInfo.COLOR_TYPE_RGB;
+        final ImageInfo.ColorType colorType = ImageInfo.ColorType.RGB;
         final String compressionAlgorithm = 
ImageInfo.COMPRESSION_ALGORITHM_LZW;
 
         return new ImageInfo(formatDetails, bitsPerPixel, comments,

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -103,7 +103,7 @@ public class IcnsImageParser extends Ima
                 ImageFormats.ICNS, "ICNS Apple Icon Image",
                 image0.getHeight(), "image/x-icns", images.size(), 0, 0, 0, 0,
                 image0.getWidth(), false, true, false,
-                ImageInfo.COLOR_TYPE_RGB,
+                ImageInfo.ColorType.RGB,
                 ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN);
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -808,33 +808,33 @@ public class JpegImageParser extends Ima
         final boolean usesPalette = false; // TODO: inaccurate.
         
         // See 
http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
-        int colorType = ImageInfo.COLOR_TYPE_UNKNOWN;
+        ImageInfo.ColorType colorType = ImageInfo.ColorType.UNKNOWN;
         // Some images have both JFIF/APP0 and APP14.
         // JFIF is meant to win but in them APP14 is clearly right, so make it 
win.
         if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
             final int colorTransform = app14Segment.getAdobeColorTransform();
             if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN) 
{ 
                 if (numberOfComponents == 3) {
-                    colorType = ImageInfo.COLOR_TYPE_RGB;
+                    colorType = ImageInfo.ColorType.RGB;
                 } else if (numberOfComponents == 4) {
-                    colorType = ImageInfo.COLOR_TYPE_CMYK;
+                    colorType = ImageInfo.ColorType.CMYK;
                 }
             } else if (colorTransform == 
App14Segment.ADOBE_COLOR_TRANSFORM_YCbCr) {
-                colorType = ImageInfo.COLOR_TYPE_YCbCr;
+                colorType = ImageInfo.ColorType.YCbCr;
             } else if (colorTransform == 
App14Segment.ADOBE_COLOR_TRANSFORM_YCCK) {
-                colorType = ImageInfo.COLOR_TYPE_YCCK;
+                colorType = ImageInfo.ColorType.YCCK;
             }
         } else if (jfifSegment != null) {
             if (numberOfComponents == 1) {
-                colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+                colorType = ImageInfo.ColorType.GRAYSCALE;
             } else if (numberOfComponents == 3) {
-                colorType = ImageInfo.COLOR_TYPE_YCbCr;
+                colorType = ImageInfo.ColorType.YCbCr;
             }
         } else {
             if (numberOfComponents == 1) {
-                colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+                colorType = ImageInfo.ColorType.GRAYSCALE;
             } else if (numberOfComponents == 2) {
-                colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+                colorType = ImageInfo.ColorType.GRAYSCALE;
                 transparent = true;
             } else if (numberOfComponents == 3 || numberOfComponents == 4) {
                 boolean have1 = false;
@@ -857,9 +857,9 @@ public class JpegImageParser extends Ima
                     }
                 }
                 if (numberOfComponents == 3 && have1 && have2 && have3 && 
!have4 && !haveOther) {
-                    colorType = ImageInfo.COLOR_TYPE_YCbCr;
+                    colorType = ImageInfo.ColorType.YCbCr;
                 } else if (numberOfComponents == 4 && have1 && have2 && have3 
&& have4 && !haveOther) {
-                    colorType = ImageInfo.COLOR_TYPE_YCbCr;
+                    colorType = ImageInfo.ColorType.YCbCr;
                     transparent = true;
                 } else {
                     boolean haveR = false;
@@ -888,14 +888,14 @@ public class JpegImageParser extends Ima
                         }
                     }
                     if (haveR && haveG && haveB && !haveA && !haveC && !havec 
&& !haveY) {
-                        colorType = ImageInfo.COLOR_TYPE_RGB;
+                        colorType = ImageInfo.ColorType.RGB;
                     } else if (haveR && haveG && haveB && haveA && !haveC && 
!havec && !haveY) {
-                        colorType = ImageInfo.COLOR_TYPE_RGB;
+                        colorType = ImageInfo.ColorType.RGB;
                         transparent = true;
                     } else if (haveY && haveC && havec && !haveR && !haveG && 
!haveB && !haveA) {
-                        colorType = ImageInfo.COLOR_TYPE_YCC;
+                        colorType = ImageInfo.ColorType.YCC;
                     } else if (haveY && haveC && havec && haveA && !haveR && 
!haveG && !haveB) {
-                        colorType = ImageInfo.COLOR_TYPE_YCC;
+                        colorType = ImageInfo.ColorType.YCC;
                         transparent = true;
                     } else {
                         int minHorizontalSamplingFactor = Integer.MAX_VALUE;
@@ -920,15 +920,15 @@ public class JpegImageParser extends Ima
                                 || (minVerticalSamplingFactor != 
maxVerticalSamplingFactor);
                         if (numberOfComponents == 3) {
                             if (isSubsampled) {
-                                colorType = ImageInfo.COLOR_TYPE_YCbCr;
+                                colorType = ImageInfo.ColorType.YCbCr;
                             } else {
-                                colorType = ImageInfo.COLOR_TYPE_RGB;
+                                colorType = ImageInfo.ColorType.RGB;
                             }
                         } else if (numberOfComponents == 4) {
                             if (isSubsampled) {
-                                colorType = ImageInfo.COLOR_TYPE_YCCK;
+                                colorType = ImageInfo.ColorType.YCCK;
                             } else {
-                                colorType = ImageInfo.COLOR_TYPE_CMYK;
+                                colorType = ImageInfo.ColorType.CMYK;
                             }
                         }
                     }
@@ -1095,13 +1095,13 @@ public class JpegImageParser extends Ima
     // boolean usesPalette = false; // TODO: inaccurate.
     // int ColorType;
     // if (Number_of_components == 1)
-    // ColorType = ImageInfo.COLOR_TYPE_BW;
+    // ColorType = ImageInfo.ColorType.BW;
     // else if (Number_of_components == 3)
-    // ColorType = ImageInfo.COLOR_TYPE_RGB;
+    // ColorType = ImageInfo.ColorType.RGB;
     // else if (Number_of_components == 4)
-    // ColorType = ImageInfo.COLOR_TYPE_CMYK;
+    // ColorType = ImageInfo.ColorType.CMYK;
     // else
-    // ColorType = ImageInfo.COLOR_TYPE_UNKNOWN;
+    // ColorType = ImageInfo.ColorType.UNKNOWN;
     //
     // String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_JPEG;
     //

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -121,7 +121,7 @@ public class PcxImageParser extends Imag
                 false,
                 false,
                 !(pcxHeader.nPlanes == 3 && pcxHeader.bitsPerPixel == 8),
-                ImageInfo.COLOR_TYPE_RGB,
+                ImageInfo.ColorType.RGB,
                 pcxHeader.encoding == PcxHeader.ENCODING_RLE ? 
ImageInfo.COMPRESSION_ALGORITHM_RLE
                         : ImageInfo.COMPRESSION_ALGORITHM_NONE);
     }

Copied: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
 (from r1648081, 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ColorType.java)
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java?p2=commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java&p1=commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ColorType.java&r1=1648081&r2=1648096&rev=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ColorType.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
 Sat Dec 27 19:32:38 2014
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.forma
 
 import java.util.Arrays;
 
-public enum ColorType {
+public enum PngColorType {
 
     GREYSCALE(0, true, false, 1, new int[]{1, 2, 4, 8, 16}),
     TRUE_COLOR(2, false, false, 3, new int[]{8, 16}),
@@ -33,7 +33,7 @@ public enum ColorType {
     private final int samplesPerPixel;
     private final int[] allowedBitDepths;
 
-    ColorType(int value, boolean greyscale, boolean alpha, int 
samplesPerPixel, int[] allowedBitDepths) {
+    PngColorType(int value, boolean greyscale, boolean alpha, int 
samplesPerPixel, int[] allowedBitDepths) {
         this.value = value;
         this.greyscale = greyscale;
         this.alpha = alpha;
@@ -61,8 +61,8 @@ public enum ColorType {
         return Arrays.binarySearch(allowedBitDepths, bitDepth) >= 0;
     }
 
-    public static ColorType getColorType(int value) {
-        for (ColorType type : values()) {
+    public static PngColorType getColorType(int value) {
+        for (PngColorType type : values()) {
             if (type.value == value) {
                 return type;
             }
@@ -71,17 +71,17 @@ public enum ColorType {
         return null;
     }
 
-    static ColorType getColorType(boolean alpha, boolean grayscale) {
+    static PngColorType getColorType(boolean alpha, boolean grayscale) {
         if (grayscale) {
             if (alpha) {
-                return ColorType.GREYSCALE_WITH_ALPHA;
+                return PngColorType.GREYSCALE_WITH_ALPHA;
             } else {
-                return ColorType.GREYSCALE;
+                return PngColorType.GREYSCALE;
             }
         } else if (alpha) {
-            return ColorType.TRUE_COLOR_WITH_ALPHA;
+            return PngColorType.TRUE_COLOR_WITH_ALPHA;
         } else {
-            return ColorType.TRUE_COLOR;
+            return PngColorType.TRUE_COLOR;
         }
     }
 }

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageInfo.java
 Sat Dec 27 19:32:38 2014
@@ -31,7 +31,7 @@ public class PngImageInfo extends ImageI
             final int physicalHeightDpi, final float physicalHeightInch,
             final int physicalWidthDpi, final float physicalWidthInch, final 
int width,
             final boolean progressive, final boolean transparent, final 
boolean usesPalette,
-            final int colorType, final String compressionAlgorithm,
+            final ImageInfo.ColorType colorType, final String 
compressionAlgorithm,
             final List<PngText> textChunks) {
         super(formatDetails, bitsPerPixel, comments, format, formatName,
                 height, mimeType, numberOfImages, physicalHeightDpi,

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -316,9 +316,9 @@ public class PngImageParser extends Imag
     // BinaryFileParser
     // I may not have always preserved byte order correctly.
 
-    private TransparencyFilter getTransparencyFilter(ColorType colorType, 
PngChunk pngChunktRNS)
+    private TransparencyFilter getTransparencyFilter(PngColorType 
pngColorType, PngChunk pngChunktRNS)
             throws ImageReadException, IOException {
-        switch (colorType) {
+        switch (pngColorType) {
             case GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale sample.
                 return new 
TransparencyFilterGrayscale(pngChunktRNS.getBytes());
             case TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
@@ -328,7 +328,7 @@ public class PngImageParser extends Imag
             case GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale 
sample,
             case TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B triple,
             default:
-                throw new ImageReadException("Simple Transparency not 
compatible with ColorType: " + colorType);
+                throw new ImageReadException("Simple Transparency not 
compatible with ColorType: " + pngColorType);
         }
     }
 
@@ -366,7 +366,7 @@ public class PngImageParser extends Imag
             transparent = true;
         } else {
             // CE - Fix Alpha.
-            transparent = pngChunkIHDR.colorType.hasAlpha();
+            transparent = pngChunkIHDR.pngColorType.hasAlpha();
             // END FIX
         }
 
@@ -403,7 +403,7 @@ public class PngImageParser extends Imag
             textChunks.add(pngChunkiTXt.getContents());
         }
 
-        final int bitsPerPixel = pngChunkIHDR.bitDepth * 
pngChunkIHDR.colorType.getSamplesPerPixel();
+        final int bitsPerPixel = pngChunkIHDR.bitDepth * 
pngChunkIHDR.pngColorType.getSamplesPerPixel();
         final ImageFormat format = ImageFormats.PNG;
         final String formatName = "PNG Portable Network Graphics";
         final int height = pngChunkIHDR.height;
@@ -444,19 +444,19 @@ public class PngImageParser extends Imag
             usesPalette = true;
         }
 
-        int colorType;
-        switch (pngChunkIHDR.colorType) {
+        ImageInfo.ColorType colorType;
+        switch (pngChunkIHDR.pngColorType) {
             case GREYSCALE:
             case GREYSCALE_WITH_ALPHA:
-                colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+                colorType = ImageInfo.ColorType.GRAYSCALE;
                 break;
             case TRUE_COLOR:
             case INDEXED_COLOR:
             case TRUE_COLOR_WITH_ALPHA:
-                colorType = ImageInfo.COLOR_TYPE_RGB;
+                colorType = ImageInfo.ColorType.RGB;
                 break;
             default:
-                throw new ImageReadException("Png: Unknown ColorType: " + 
pngChunkIHDR.colorType);
+                throw new ImageReadException("Png: Unknown ColorType: " + 
pngChunkIHDR.pngColorType);
         }
 
         final String compressionAlgorithm = 
ImageInfo.COMPRESSION_ALGORITHM_PNG_FILTER;
@@ -537,7 +537,7 @@ public class PngImageParser extends Imag
         final List<PngChunk> tRNSs = filterChunks(chunks, ChunkType.tRNS);
         if (!tRNSs.isEmpty()) {
             final PngChunk pngChunktRNS = tRNSs.get(0);
-            transparencyFilter = getTransparencyFilter(pngChunkIHDR.colorType, 
pngChunktRNS);
+            transparencyFilter = 
getTransparencyFilter(pngChunkIHDR.pngColorType, pngChunktRNS);
         }
 
         ICC_Profile iccProfile = null;
@@ -594,19 +594,19 @@ public class PngImageParser extends Imag
         {
             final int width = pngChunkIHDR.width;
             final int height = pngChunkIHDR.height;
-            final ColorType colorType = pngChunkIHDR.colorType;
+            final PngColorType pngColorType = pngChunkIHDR.pngColorType;
             final int bitDepth = pngChunkIHDR.bitDepth;
 
             if (pngChunkIHDR.filterMethod != 0) {
                 throw new ImageReadException("PNG: unknown FilterMethod: " + 
pngChunkIHDR.filterMethod);
             }
 
-            final int bitsPerPixel = bitDepth * colorType.getSamplesPerPixel();
+            final int bitsPerPixel = bitDepth * 
pngColorType.getSamplesPerPixel();
 
-            final boolean hasAlpha = colorType.hasAlpha() || 
transparencyFilter != null;
+            final boolean hasAlpha = pngColorType.hasAlpha() || 
transparencyFilter != null;
 
             BufferedImage result;
-            if (colorType.isGreyscale()) {
+            if (pngColorType.isGreyscale()) {
                 result = 
getBufferedImageFactory(params).getGrayscaleBufferedImage(width, height, 
hasAlpha);
             } else {
                 result = 
getBufferedImageFactory(params).getColorBufferedImage(width, height, hasAlpha);
@@ -620,12 +620,12 @@ public class PngImageParser extends Imag
             switch (pngChunkIHDR.interlaceMethod) {
                 case NONE:
                     scanExpediter = new ScanExpediterSimple(width, height, iis,
-                            result, colorType, bitDepth, bitsPerPixel,
+                            result, pngColorType, bitDepth, bitsPerPixel,
                             pngChunkPLTE, gammaCorrection, transparencyFilter);
                     break;
                 case ADAM7:
                     scanExpediter = new ScanExpediterInterlaced(width, height, 
iis,
-                            result, colorType, bitDepth, bitsPerPixel,
+                            result, pngColorType, bitDepth, bitsPerPixel,
                             pngChunkPLTE, gammaCorrection, transparencyFilter);
                     break;
                 default:
@@ -671,7 +671,7 @@ public class PngImageParser extends Imag
             return false;
         }
         final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) IHDRs.get(0);
-        pw.println("Color: " + pngChunkIHDR.colorType.name());
+        pw.println("Color: " + pngChunkIHDR.pngColorType.name());
 
         pw.println("chunks: " + chunks.size());
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
 Sat Dec 27 19:32:38 2014
@@ -91,18 +91,18 @@ class PngWriter {
         public final int width;
         public final int height;
         public final byte bitDepth;
-        public final ColorType colorType;
+        public final PngColorType pngColorType;
         public final byte compressionMethod;
         public final byte filterMethod;
         public final InterlaceMethod interlaceMethod;
 
         public ImageHeader(final int width, final int height, final byte 
bitDepth,
-                final ColorType colorType, final byte compressionMethod, final 
byte filterMethod,
+                final PngColorType pngColorType, final byte compressionMethod, 
final byte filterMethod,
                 InterlaceMethod interlaceMethod) {
             this.width = width;
             this.height = height;
             this.bitDepth = bitDepth;
-            this.colorType = colorType;
+            this.pngColorType = pngColorType;
             this.compressionMethod = compressionMethod;
             this.filterMethod = filterMethod;
             this.interlaceMethod = interlaceMethod;
@@ -115,7 +115,7 @@ class PngWriter {
         writeInt(baos, value.width);
         writeInt(baos, value.height);
         baos.write(0xff & value.bitDepth);
-        baos.write(0xff & value.colorType.getValue());
+        baos.write(0xff & value.pngColorType.getValue());
         baos.write(0xff & value.compressionMethod);
         baos.write(0xff & value.filterMethod);
         baos.write(0xff & value.interlaceMethod.ordinal());
@@ -297,7 +297,7 @@ class PngWriter {
         writeChunk(os, ChunkType.pHYs, bytes);
     }
 
-    private byte getBitDepth(final ColorType colorType, final Map<String, 
Object> params) {
+    private byte getBitDepth(final PngColorType pngColorType, final 
Map<String, Object> params) {
         byte depth = 8;
 
         Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
@@ -305,7 +305,7 @@ class PngWriter {
             depth = ((Number) o).byteValue();
         }
 
-        return colorType.isBitDepthAllowed(depth) ? depth : 8;
+        return pngColorType.isBitDepthAllowed(depth) ? depth : 8;
     }
 
     /// Wraps a palette by adding a single transparent entry at index 0.
@@ -420,7 +420,7 @@ class PngWriter {
             Debug.debug("isGrayscale: " + isGrayscale);
         }
 
-        ColorType colorType;
+        PngColorType pngColorType;
         {
             final boolean forceIndexedColor =  
Boolean.TRUE.equals(params.get(PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR));
             final boolean forceTrueColor = 
Boolean.TRUE.equals(params.get(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR));
@@ -429,25 +429,25 @@ class PngWriter {
                 throw new ImageWriteException(
                         "Params: Cannot force both indexed and true color 
modes");
             } else if (forceIndexedColor) {
-                colorType = ColorType.INDEXED_COLOR;
+                pngColorType = PngColorType.INDEXED_COLOR;
             } else if (forceTrueColor) {
-                colorType = (hasAlpha ? ColorType.TRUE_COLOR_WITH_ALPHA : 
ColorType.TRUE_COLOR);
+                pngColorType = (hasAlpha ? PngColorType.TRUE_COLOR_WITH_ALPHA 
: PngColorType.TRUE_COLOR);
                 isGrayscale = false;
             } else {
-                colorType = ColorType.getColorType(hasAlpha, isGrayscale);
+                pngColorType = PngColorType.getColorType(hasAlpha, 
isGrayscale);
             }
             if (verbose) {
-                Debug.debug("colorType: " + colorType);
+                Debug.debug("colorType: " + pngColorType);
             }
         }
 
-        final byte bitDepth = getBitDepth(colorType, params);
+        final byte bitDepth = getBitDepth(pngColorType, params);
         if (verbose) {
             Debug.debug("bitDepth: " + bitDepth);
         }
 
         int sampleDepth;
-        if (colorType == ColorType.INDEXED_COLOR) {
+        if (pngColorType == PngColorType.INDEXED_COLOR) {
             sampleDepth = 8;
         } else {
             sampleDepth = bitDepth;
@@ -467,7 +467,7 @@ class PngWriter {
             final InterlaceMethod interlaceMethod = InterlaceMethod.NONE;
 
             final ImageHeader imageHeader = new ImageHeader(width, height, 
bitDepth,
-                    colorType, compressionMethod, filterMethod, 
interlaceMethod);
+                    pngColorType, compressionMethod, filterMethod, 
interlaceMethod);
 
             writeChunkIHDR(os, imageHeader);
         }
@@ -480,7 +480,7 @@ class PngWriter {
         //}
 
         Palette palette = null;
-        if (colorType == ColorType.INDEXED_COLOR) {
+        if (pngColorType == PngColorType.INDEXED_COLOR) {
             // PLTE No Before first IDAT
 
             final int maxColors = hasAlpha ? 255 : 256;
@@ -548,8 +548,8 @@ class PngWriter {
             {
                 final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-                final boolean useAlpha = colorType == 
ColorType.GREYSCALE_WITH_ALPHA
-                        || colorType == ColorType.TRUE_COLOR_WITH_ALPHA;
+                final boolean useAlpha = pngColorType == 
PngColorType.GREYSCALE_WITH_ALPHA
+                        || pngColorType == PngColorType.TRUE_COLOR_WITH_ALPHA;
 
                 final int[] row = new int[width];
                 for (int y = 0; y < height; y++) {

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
 Sat Dec 27 19:32:38 2014
@@ -37,7 +37,7 @@ abstract class ScanExpediter {
     protected final int height;
     protected final InputStream is;
     protected final BufferedImage bi;
-    protected final ColorType colorType;
+    protected final PngColorType pngColorType;
     protected final int bitDepth;
     protected final int bytesPerPixel;
     protected final int bitsPerPixel;
@@ -46,7 +46,7 @@ abstract class ScanExpediter {
     protected final TransparencyFilter transparencyFilter;
 
     public ScanExpediter(final int width, final int height, final InputStream 
is,
-            final BufferedImage bi, final ColorType colorType, final int 
bitDepth, final int bitsPerPixel,
+            final BufferedImage bi, final PngColorType pngColorType, final int 
bitDepth, final int bitsPerPixel,
             final PngChunkPlte pngChunkPLTE, final GammaCorrection 
gammaCorrection,
             final TransparencyFilter transparencyFilter)
 
@@ -55,7 +55,7 @@ abstract class ScanExpediter {
         this.height = height;
         this.is = is;
         this.bi = bi;
-        this.colorType = colorType;
+        this.pngColorType = pngColorType;
         this.bitDepth = bitDepth;
         this.bytesPerPixel = this.getBitsToBytesRoundingUp(bitsPerPixel);
         this.bitsPerPixel = bitsPerPixel;
@@ -84,7 +84,7 @@ abstract class ScanExpediter {
     protected int getRGB(final BitParser bitParser, final int 
pixelIndexInScanline) 
             throws ImageReadException, IOException {
 
-        switch (colorType) {
+        switch (pngColorType) {
         case GREYSCALE: {
             // 1,2,4,8,16 Each pixel is a grayscale sample.
             int sample = bitParser.getSampleAsByte(pixelIndexInScanline, 0);
@@ -167,7 +167,7 @@ abstract class ScanExpediter {
             return getPixelARGB(alpha, red, green, blue);
         }
         default:
-            throw new ImageReadException("PNG: unknown color type: " + 
colorType);
+            throw new ImageReadException("PNG: unknown color type: " + 
pngColorType);
         }
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
 Sat Dec 27 19:32:38 2014
@@ -34,13 +34,13 @@ class ScanExpediterInterlaced extends Sc
 
     public ScanExpediterInterlaced(int width, int height, InputStream is,
             BufferedImage bi,
-            ColorType colorType, int bitDepth, int bitsPerPixel,
+            PngColorType pngColorType, int bitDepth, int bitsPerPixel,
             PngChunkPlte fPNGChunkPLTE,
             GammaCorrection gammaCorrection,
             TransparencyFilter transparencyFilter)
 
     {
-        super(width, height, is, bi, colorType, bitDepth, bitsPerPixel, 
+        super(width, height, is, bi, pngColorType, bitDepth, bitsPerPixel,
                 fPNGChunkPLTE, gammaCorrection, transparencyFilter);
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java
 Sat Dec 27 19:32:38 2014
@@ -26,12 +26,12 @@ import org.apache.commons.imaging.format
 
 class ScanExpediterSimple extends ScanExpediter {
     public ScanExpediterSimple(final int width, final int height, final 
InputStream is,
-            final BufferedImage bi, final ColorType colorType, final int 
bitDepth, final int bitsPerPixel,
+            final BufferedImage bi, final PngColorType pngColorType, final int 
bitDepth, final int bitsPerPixel,
             final PngChunkPlte pngChunkPLTE, final GammaCorrection 
gammaCorrection,
             final TransparencyFilter transparencyFilter)
 
     {
-        super(width, height, is, bi, colorType, bitDepth, bitsPerPixel, 
+        super(width, height, is, bi, pngColorType, bitDepth, bitsPerPixel,
                 pngChunkPLTE, gammaCorrection, transparencyFilter);
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
 Sat Dec 27 19:32:38 2014
@@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 
 import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.formats.png.ColorType;
+import org.apache.commons.imaging.formats.png.PngColorType;
 import org.apache.commons.imaging.formats.png.InterlaceMethod;
 
 import static org.apache.commons.imaging.common.BinaryFunctions.*;
@@ -29,7 +29,7 @@ public class PngChunkIhdr extends PngChu
     public final int width;
     public final int height;
     public final int bitDepth;
-    public final ColorType colorType;
+    public final PngColorType pngColorType;
     public final int compressionMethod;
     public final int filterMethod;
     public final InterlaceMethod interlaceMethod;
@@ -42,8 +42,8 @@ public class PngChunkIhdr extends PngChu
         height = read4Bytes("Height", is, "Not a Valid Png File: IHDR 
Corrupt", getByteOrder());
         bitDepth = readByte("BitDepth", is, "Not a Valid Png File: IHDR 
Corrupt");
         int type = readByte("ColorType", is, "Not a Valid Png File: IHDR 
Corrupt");
-        colorType = ColorType.getColorType(type);
-        if (colorType == null) {
+        pngColorType = PngColorType.getColorType(type);
+        if (pngColorType == null) {
             throw new ImageReadException("PNG: unknown color type: " + type);
         }
         compressionMethod = readByte("CompressionMethod", is, "Not a Valid Png 
File: IHDR Corrupt");

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
 Sat Dec 27 19:32:38 2014
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.apache.commons.imaging.ImageFormat;
+import org.apache.commons.imaging.ImageInfo;
 import org.apache.commons.imaging.common.ImageBuilder;
 
 abstract class FileInfo {
@@ -45,7 +46,7 @@ abstract class FileInfo {
 
     public abstract String getMIMEType();
 
-    public abstract int getColorType();
+    public abstract ImageInfo.ColorType getColorType();
 
     public abstract int getRGB(WhiteSpaceReader wsr) throws IOException;
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
 Sat Dec 27 19:32:38 2014
@@ -53,9 +53,9 @@ class PamFileInfo extends FileInfo {
 
         hasAlpha = tupleType.endsWith("_ALPHA");
         if ("BLACKANDWHITE".equals(tupleType) || 
"BLACKANDWHITE_ALPHA".equals(tupleType)) {
-            tupleReader = new GrayscaleTupleReader(ImageInfo.COLOR_TYPE_BW);
+            tupleReader = new GrayscaleTupleReader(ImageInfo.ColorType.BW);
         } else if ("GRAYSCALE".equals(tupleType) || 
"GRAYSCALE_ALPHA".equals(tupleType)) {
-            tupleReader = new 
GrayscaleTupleReader(ImageInfo.COLOR_TYPE_GRAYSCALE);
+            tupleReader = new 
GrayscaleTupleReader(ImageInfo.ColorType.GRAYSCALE);
         } else if ("RGB".equals(tupleType) || "RGB_ALPHA".equals(tupleType)) {
             tupleReader = new ColorTupleReader();
         } else {
@@ -94,7 +94,7 @@ class PamFileInfo extends FileInfo {
     }
 
     @Override
-    public int getColorType() {
+    public ImageInfo.ColorType getColorType() {
         return tupleReader.getColorType();
     }
     
@@ -109,19 +109,19 @@ class PamFileInfo extends FileInfo {
     }
 
     private abstract class TupleReader {
-        public abstract int getColorType();
+        public abstract ImageInfo.ColorType getColorType();
         public abstract int getRGB(InputStream is) throws IOException;
     }
     
     private class GrayscaleTupleReader extends TupleReader {
-        private final int colorType;
+        private final ImageInfo.ColorType colorType;
         
-        public GrayscaleTupleReader(final int colorType) {
+        public GrayscaleTupleReader(final ImageInfo.ColorType colorType) {
             this.colorType = colorType;
         }
         
         @Override
-        public int getColorType() {
+        public ImageInfo.ColorType getColorType() {
             return colorType;
         }
         
@@ -145,8 +145,8 @@ class PamFileInfo extends FileInfo {
 
     private class ColorTupleReader extends TupleReader {
         @Override
-        public int getColorType() {
-            return ImageInfo.COLOR_TYPE_RGB;
+        public ImageInfo.ColorType getColorType() {
+            return ImageInfo.ColorType.RGB;
         }
         
         @Override

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
 Sat Dec 27 19:32:38 2014
@@ -52,8 +52,8 @@ class PbmFileInfo extends FileInfo {
     }
 
     @Override
-    public int getColorType() {
-        return ImageInfo.COLOR_TYPE_BW;
+    public ImageInfo.ColorType getColorType() {
+        return ImageInfo.ColorType.BW;
     }
 
     @Override

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
 Sat Dec 27 19:32:38 2014
@@ -78,8 +78,8 @@ class PgmFileInfo extends FileInfo {
     }
 
     @Override
-    public int getColorType() {
-        return ImageInfo.COLOR_TYPE_GRAYSCALE;
+    public ImageInfo.ColorType getColorType() {
+        return ImageInfo.ColorType.GRAYSCALE;
     }
 
     @Override

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -254,7 +254,7 @@ public class PnmImageParser extends Imag
         final boolean transparent = info.hasAlpha();
         final boolean usesPalette = false;
 
-        final int colorType = info.getColorType();
+        final ImageInfo.ColorType colorType = info.getColorType();
         final String compressionAlgorithm = 
ImageInfo.COMPRESSION_ALGORITHM_NONE;
 
         return new ImageInfo(formatDetails, bitsPerPixel, comments,

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
 Sat Dec 27 19:32:38 2014
@@ -76,8 +76,8 @@ class PpmFileInfo extends FileInfo {
     }
 
     @Override
-    public int getColorType() {
-        return ImageInfo.COLOR_TYPE_RGB;
+    public ImageInfo.ColorType getColorType() {
+        return ImageInfo.ColorType.RGB;
     }
 
     @Override

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -517,7 +517,7 @@ public class PsdImageParser extends Imag
 
         final boolean transparent = false; // TODO: inaccurate.
         final boolean usesPalette = header.mode == COLOR_MODE_INDEXED;
-        final int colorType = ImageInfo.COLOR_TYPE_UNKNOWN;
+        final ImageInfo.ColorType colorType = ImageInfo.ColorType.UNKNOWN;
 
         String compressionAlgorithm;
         switch (imageContents.Compression) {

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -97,7 +97,7 @@ public class RgbeImageParser extends Ima
                     new ArrayList<String>(), ImageFormats.RGBE, getName(),
                     info.getHeight(), "image/vnd.radiance", 1, -1, -1, -1, -1,
                     info.getWidth(), false, false, false,
-                    ImageInfo.COLOR_TYPE_RGB, "Adaptive RLE");
+                    ImageInfo.ColorType.RGB, "Adaptive RLE");
             canThrow = true;
             return ret;
         } finally {

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -257,7 +257,7 @@ public class TiffImageParser extends Ima
             usesPalette = true;
         }
 
-        final int colorType = ImageInfo.COLOR_TYPE_RGB;
+        final ImageInfo.ColorType colorType = ImageInfo.ColorType.RGB;
 
         final int compression = 0xffff & directory
                 .getSingleFieldValue(TiffTagConstants.TIFF_TAG_COMPRESSION);

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/wbmp/WbmpImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -83,7 +83,7 @@ public class WbmpImageParser extends Ima
                 ImageFormats.WBMP,
                 "Wireless Application Protocol Bitmap", wbmpHeader.height,
                 "image/vnd.wap.wbmp", 1, 0, 0, 0, 0, wbmpHeader.width, false,
-                false, false, ImageInfo.COLOR_TYPE_BW,
+                false, false, ImageInfo.ColorType.BW,
                 ImageInfo.COMPRESSION_ALGORITHM_NONE);
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -87,7 +87,7 @@ public class XbmImageParser extends Imag
         return new ImageInfo("XBM", 1, new ArrayList<String>(),
                 ImageFormats.XBM, "X BitMap", xbmHeader.height,
                 "image/x-xbitmap", 1, 0, 0, 0, 0, xbmHeader.width, false,
-                false, false, ImageInfo.COLOR_TYPE_BW,
+                false, false, ImageInfo.ColorType.BW,
                 ImageInfo.COMPRESSION_ALGORITHM_NONE);
     }
 

Modified: 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
 (original)
+++ 
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
 Sat Dec 27 19:32:38 2014
@@ -144,7 +144,7 @@ public class XpmImageParser extends Imag
             throws ImageReadException, IOException {
         final XpmHeader xpmHeader = readXpmHeader(byteSource);
         boolean transparent = false;
-        int colorType = ImageInfo.COLOR_TYPE_BW;
+        ImageInfo.ColorType colorType = ImageInfo.ColorType.BW;
         for (final Entry<Object, PaletteEntry> entry : xpmHeader.palette
                 .entrySet()) {
          final PaletteEntry paletteEntry = entry.getValue();
@@ -152,10 +152,10 @@ public class XpmImageParser extends Imag
         transparent = true;
          }
          if (paletteEntry.haveColor) {
-        colorType = ImageInfo.COLOR_TYPE_RGB;
-         } else if (colorType != ImageInfo.COLOR_TYPE_RGB
+        colorType = ImageInfo.ColorType.RGB;
+         } else if (colorType != ImageInfo.ColorType.RGB
             && (paletteEntry.haveGray || paletteEntry.haveGray4Level)) {
-        colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+        colorType = ImageInfo.ColorType.GRAYSCALE;
          }
       }
         return new ImageInfo("XPM version 3", xpmHeader.numCharsPerPixel * 8,

Modified: 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
URL: 
http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java?rev=1648096&r1=1648095&r2=1648096&view=diff
==============================================================================
--- 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
 (original)
+++ 
commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java
 Sat Dec 27 19:32:38 2014
@@ -84,7 +84,7 @@ public class SampleUsage {
             // transparency, etc.) </b>
             final ImageInfo imageInfo = Imaging.getImageInfo(imageBytes);
 
-            if (imageInfo.getColorType() == ImageInfo.COLOR_TYPE_GRAYSCALE) {
+            if (imageInfo.getColorType() == ImageInfo.ColorType.GRAYSCALE) {
                 System.out.println("Grayscale image.");
             }
             if (imageInfo.getHeight() > 1000) {


Reply via email to