commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1545998 [4/5] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/ main/java/org/apache/commons/imaging/common/ main/java/org/apache/commons/imaging/common/mylzw/ main/java/org/apache/commons/imaging/formats/bmp/ m...
Date Wed, 27 Nov 2013 11:21:16 GMT
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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -103,23 +103,18 @@ public class PsdImageParser extends Imag
         }
     }
 
-    private PsdHeaderInfo readHeader(final InputStream is) throws ImageReadException,
-            IOException {
-        readAndVerifyBytes(is, new byte[] { 56, 66, 80, 83 },
-                "Not a Valid PSD File");
-
-        final int Version = read2Bytes("Version", is, "Not a Valid PSD File");
-
-        final byte[] Reserved = readBytes("Reserved", is, 6,
-                "Not a Valid PSD File");
+    private PsdHeaderInfo readHeader(final InputStream is) throws ImageReadException, IOException {
+        readAndVerifyBytes(is, new byte[] { 56, 66, 80, 83 }, "Not a Valid PSD File");
 
-        final int Channels = read2Bytes("Channels", is, "Not a Valid PSD File");
-        final int Rows = read4Bytes("Rows", is, "Not a Valid PSD File");
-        final int Columns = read4Bytes("Columns", is, "Not a Valid PSD File");
-        final int Depth = read2Bytes("Depth", is, "Not a Valid PSD File");
-        final int Mode = read2Bytes("Mode", is, "Not a Valid PSD File");
+        final int version = read2Bytes("Version", is, "Not a Valid PSD File");
+        final byte[] reserved = readBytes("Reserved", is, 6, "Not a Valid PSD File");
+        final int channels = read2Bytes("Channels", is, "Not a Valid PSD File");
+        final int rows = read4Bytes("Rows", is, "Not a Valid PSD File");
+        final int columns = read4Bytes("Columns", is, "Not a Valid PSD File");
+        final int depth = read2Bytes("Depth", is, "Not a Valid PSD File");
+        final int mode = read2Bytes("Mode", is, "Not a Valid PSD File");
 
-        return new PsdHeaderInfo(Version, Reserved, Channels, Rows, Columns, Depth, Mode);
+        return new PsdHeaderInfo(version, reserved, channels, rows, columns, depth, mode);
     }
 
     private ImageContents readImageContents(final InputStream is)
@@ -280,36 +275,33 @@ public class PsdImageParser extends Imag
             skipBytes(is, PSD_HEADER_LENGTH);
             // is.skip(kHeaderLength);
 
-            final int ColorModeDataLength = read4Bytes("ColorModeDataLength", is,
-                    "Not a Valid PSD File");
+            final int colorModeDataLength = read4Bytes("ColorModeDataLength", is, "Not a Valid PSD File");
 
             if (section == PSD_SECTION_COLOR_MODE) {
                 return is;
             }
 
-            skipBytes(is, ColorModeDataLength);
+            skipBytes(is, colorModeDataLength);
             // byte ColorModeData[] = readByteArray("ColorModeData",
             // ColorModeDataLength, is, "Not a Valid PSD File");
 
-            final int ImageResourcesLength = read4Bytes("ImageResourcesLength", is,
-                    "Not a Valid PSD File");
+            final int imageResourcesLength = read4Bytes("ImageResourcesLength", is, "Not a Valid PSD File");
 
             if (section == PSD_SECTION_IMAGE_RESOURCES) {
                 return is;
             }
 
-            skipBytes(is, ImageResourcesLength);
+            skipBytes(is, imageResourcesLength);
             // byte ImageResources[] = readByteArray("ImageResources",
             // ImageResourcesLength, is, "Not a Valid PSD File");
 
-            final int LayerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength",
-                    is, "Not a Valid PSD File");
+            final int layerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength", is, "Not a Valid PSD File");
 
             if (section == PSD_SECTION_LAYER_AND_MASK_DATA) {
                 return is;
             }
 
-            skipBytes(is, LayerAndMaskDataLength);
+            skipBytes(is, layerAndMaskDataLength);
             // byte LayerAndMaskData[] = readByteArray("LayerAndMaskData",
             // LayerAndMaskDataLength, is, "Not a Valid PSD File");
 
@@ -444,7 +436,7 @@ public class PsdImageParser extends Imag
             throw new ImageReadException("PSD: couldn't read header");
         }
 
-        return new Dimension(bhi.Columns, bhi.Rows);
+        return new Dimension(bhi.columns, bhi.rows);
 
     }
 
@@ -502,13 +494,13 @@ public class PsdImageParser extends Imag
             throw new ImageReadException("PSD: Couldn't read Header");
         }
 
-        final int Width = header.Columns;
-        final int Height = header.Rows;
+        final int width = header.columns;
+        final int height = header.rows;
 
-        final List<String> Comments = new ArrayList<String>();
+        final List<String> comments = new ArrayList<String>();
         // TODO: comments...
 
-        int BitsPerPixel = header.Depth * getChannelsPerMode(header.Mode);
+        int BitsPerPixel = header.depth * getChannelsPerMode(header.mode);
         // System.out.println("header.Depth: " + header.Depth);
         // System.out.println("header.Mode: " + header.Mode);
         // System.out.println("getChannelsPerMode(header.Mode): " +
@@ -516,24 +508,24 @@ public class PsdImageParser extends Imag
         if (BitsPerPixel < 0) {
             BitsPerPixel = 0;
         }
-        final ImageFormat Format = ImageFormats.PSD;
-        final String FormatName = "Photoshop";
-        final String MimeType = "image/x-photoshop";
+        final ImageFormat format = ImageFormats.PSD;
+        final String formatName = "Photoshop";
+        final String mimeType = "image/x-photoshop";
         // we ought to count images, but don't yet.
-        final int NumberOfImages = -1;
+        final int numberOfImages = -1;
         // not accurate ... only reflects first
         final boolean isProgressive = false;
 
-        final int PhysicalWidthDpi = 72;
-        final float PhysicalWidthInch = (float) ((double) Width / (double) PhysicalWidthDpi);
-        final int PhysicalHeightDpi = 72;
-        final float PhysicalHeightInch = (float) ((double) Height / (double) PhysicalHeightDpi);
+        final int physicalWidthDpi = 72;
+        final float physicalWidthInch = (float) ((double) width / (double) physicalWidthDpi);
+        final int physicalHeightDpi = 72;
+        final float physicalHeightInch = (float) ((double) height / (double) physicalHeightDpi);
 
-        final String FormatDetails = "Psd";
+        final String formatDetails = "Psd";
 
         final boolean isTransparent = false; // TODO: inaccurate.
-        final boolean usesPalette = header.Mode == COLOR_MODE_INDEXED;
-        final int ColorType = ImageInfo.COLOR_TYPE_UNKNOWN;
+        final boolean usesPalette = header.mode == COLOR_MODE_INDEXED;
+        final int colorType = ImageInfo.COLOR_TYPE_UNKNOWN;
 
         String compressionAlgorithm;
         switch (imageContents.Compression) {
@@ -547,11 +539,11 @@ public class PsdImageParser extends Imag
             compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN;
         }
 
-        return new ImageInfo(FormatDetails, BitsPerPixel, Comments,
-                Format, FormatName, Height, MimeType, NumberOfImages,
-                PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
-                PhysicalWidthInch, Width, isProgressive, isTransparent,
-                usesPalette, ColorType, compressionAlgorithm);
+        return new ImageInfo(formatDetails, BitsPerPixel, comments,
+                format, formatName, height, mimeType, numberOfImages,
+                physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
+                physicalWidthInch, width, isProgressive, isTransparent,
+                usesPalette, colorType, compressionAlgorithm);
     }
 
 //    // TODO not used
@@ -639,8 +631,8 @@ public class PsdImageParser extends Imag
         // fImageContents.ImageResources,
                 null, -1);
 
-        final int width = header.Columns;
-        final int height = header.Rows;
+        final int width = header.columns;
+        final int height = header.rows;
         // int height = header.Columns;
 
         // int transfer_type;
@@ -652,7 +644,7 @@ public class PsdImageParser extends Imag
                 .getColorBufferedImage(width, height, hasAlpha);
 
         DataParser dataParser;
-        switch (imageContents.header.Mode) {
+        switch (imageContents.header.mode) {
         case 0: // bitmap
             dataParser = new DataParserBitmap();
             break;
@@ -693,7 +685,7 @@ public class PsdImageParser extends Imag
             // break;
         default:
             throw new ImageReadException("Unknown Mode: "
-                    + imageContents.header.Mode);
+                    + imageContents.header.mode);
         }
         DataReader fDataReader;
         switch (imageContents.Compression) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java Wed Nov 27 11:21:14 2013
@@ -28,8 +28,8 @@ public abstract class DataParser {
         final DataBuffer buffer = bi.getRaster().getDataBuffer();
 
         final PsdHeaderInfo header = imageContents.header;
-        final int width = header.Columns;
-        final int height = header.Rows;
+        final int width = header.columns;
+        final int height = header.rows;
 
         for (int y = 0; y < height; y++) {
             for (int x = 0; x < width; x++) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java Wed Nov 27 11:21:14 2013
@@ -19,27 +19,27 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
 public class DataParserIndexed extends DataParser {
-    private final int[] ColorTable;
+    private final int[] colorTable;
 
-    public DataParserIndexed(final byte[] ColorModeData) {
-        ColorTable = new int[256];
+    public DataParserIndexed(final byte[] colorModeData) {
+        colorTable = new int[256];
         for (int i = 0; i < 256; i++) {
-            final int red = 0xff & ColorModeData[0 * 256 + i];
-            final int green = 0xff & ColorModeData[1 * 256 + i];
-            final int blue = 0xff & ColorModeData[2 * 256 + i];
+            final int red = 0xff & colorModeData[0 * 256 + i];
+            final int green = 0xff & colorModeData[1 * 256 + i];
+            final int blue = 0xff & colorModeData[2 * 256 + i];
             final int alpha = 0xff;
 
             final int rgb = ((0xff & alpha) << 24) | ((0xff & red) << 16)
                     | ((0xff & green) << 8) | ((0xff & blue) << 0);
 
-            ColorTable[i] = rgb;
+            colorTable[i] = rgb;
         }
     }
 
     @Override
     protected int getRGB(final int[][][] data, final int x, final int y, final ImageContents imageContents) {
         final int sample = 0xff & data[0][y][x];
-        return ColorTable[sample];
+        return colorTable[sample];
     }
 
     @Override

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java Wed Nov 27 11:21:14 2013
@@ -44,30 +44,30 @@ public class CompressedDataReader extend
             final ImageContents imageContents, final BinaryFileParser bfp)
             throws ImageReadException, IOException {
         final PsdHeaderInfo header = imageContents.header;
-        final int width = header.Columns;
-        final int height = header.Rows;
+        final int width = header.columns;
+        final int height = header.rows;
 
         // this.setDebug(true);
-        final int scanline_count = height * header.Channels;
-        final int[] scanline_bytecounts = new int[scanline_count];
-        for (int i = 0; i < scanline_count; i++) {
-            scanline_bytecounts[i] = BinaryFunctions.read2Bytes("scanline_bytecount[" + i
+        final int scanlineCount = height * header.channels;
+        final int[] scanlineBytecounts = new int[scanlineCount];
+        for (int i = 0; i < scanlineCount; i++) {
+            scanlineBytecounts[i] = BinaryFunctions.read2Bytes("scanline_bytecount[" + i
                     + "]", is, "PSD: bad Image Data", bfp.getByteOrder());
         }
         bfp.setDebug(false);
         // System.out.println("fImageContents.Compression: "
         // + imageContents.Compression);
 
-        final int depth = header.Depth;
+        final int depth = header.depth;
 
-        final int channel_count = dataParser.getBasicChannelsCount();
-        final int[][][] data = new int[channel_count][height][];
+        final int channelCount = dataParser.getBasicChannelsCount();
+        final int[][][] data = new int[channelCount][height][];
         // channels[0] =
-        for (int channel = 0; channel < channel_count; channel++) {
+        for (int channel = 0; channel < channelCount; channel++) {
             for (int y = 0; y < height; y++) {
                 final int index = channel * height + y;
                 final byte[] packed = BinaryFunctions.readBytes("scanline",
-                        is, scanline_bytecounts[index],
+                        is, scanlineBytecounts[index],
                         "PSD: Missing Image Data");
 
                 final byte[] unpacked = new PackBits().decompress(packed, width);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java Wed Nov 27 11:21:14 2013
@@ -40,13 +40,13 @@ public class UncompressedDataReader exte
             final ImageContents imageContents, final BinaryFileParser bfp)
             throws ImageReadException, IOException {
         final PsdHeaderInfo header = imageContents.header;
-        final int width = header.Columns;
-        final int height = header.Rows;
+        final int width = header.columns;
+        final int height = header.rows;
 
         bfp.setDebug(false);
 
-        final int channel_count = dataParser.getBasicChannelsCount();
-        final int depth = header.Depth;
+        final int channelCount = dataParser.getBasicChannelsCount();
+        final int depth = header.depth;
         final MyBitInputStream mbis = new MyBitInputStream(is, ByteOrder.BIG_ENDIAN);
         // we want all samples to be bytes
         BitsToByteInputStream bbis = null;
@@ -54,8 +54,8 @@ public class UncompressedDataReader exte
         try {
             bbis = new BitsToByteInputStream(mbis, 8);
 
-            final int[][][] data = new int[channel_count][height][width];
-            for (int channel = 0; channel < channel_count; channel++) {
+            final int[][][] data = new int[channelCount][height][width];
+            for (int channel = 0; channel < channelCount; channel++) {
                 for (int y = 0; y < height; y++) {
                     for (int x = 0; x < width; x++) {
                         final int b = bbis.readBits(depth);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java Wed Nov 27 11:21:14 2013
@@ -32,11 +32,10 @@ import org.apache.commons.imaging.common
 
 class RgbeInfo implements Closeable {
     // #?RADIANCE
-    private static byte[] HEADER = new byte[] {
+    private static final byte[] HEADER = new byte[] {
         0x23, 0x3F, 0x52, 0x41, 0x44, 0x49, 0x41, 0x4E, 0x43, 0x45
     };
-    private static final Pattern RESOLUTION_STRING = Pattern
-            .compile("-Y (\\d+) \\+X (\\d+)");
+    private static final Pattern RESOLUTION_STRING = Pattern.compile("-Y (\\d+) \\+X (\\d+)");
 
     private final BinaryInputStream in;
     private ImageMetadata metadata;
@@ -95,8 +94,7 @@ class RgbeInfo implements Closeable {
     }
 
     private void readMetadata() throws IOException, ImageReadException {
-        in.readAndVerifyBytes(HEADER,
-                "Not a valid HDR: Incorrect Header");
+        in.readAndVerifyBytes(HEADER, "Not a valid HDR: Incorrect Header");
 
         final InfoHeaderReader reader = new InfoHeaderReader(in);
 
@@ -137,8 +135,7 @@ class RgbeInfo implements Closeable {
         final int wd = getWidth();
 
         if (wd >= 32768) {
-            throw new ImageReadException(
-                    "Scan lines must be less than 32768 bytes long");
+            throw new ImageReadException("Scan lines must be less than 32768 bytes long");
         }
 
         final byte[] scanLineBytes = ByteConversions.toBytes((short) wd,
@@ -147,10 +144,8 @@ class RgbeInfo implements Closeable {
         final float[][] out = new float[3][wd * ht];
 
         for (int i = 0; i < ht; i++) {
-            in.readAndVerifyBytes(TWO_TWO, "Scan line " + i
-                    + " expected to start with 0x2 0x2");
-            in.readAndVerifyBytes(scanLineBytes, "Scan line " + i
-                    + " length expected");
+            in.readAndVerifyBytes(TWO_TWO, "Scan line " + i + " expected to start with 0x2 0x2");
+            in.readAndVerifyBytes(scanLineBytes, "Scan line " + i + " length expected");
 
             decompress(in, rgbe);
 
@@ -166,8 +161,7 @@ class RgbeInfo implements Closeable {
                         out[channel][pos] = 0;
                     } else {
                         final float mult = (float) Math.pow(2, mantissa - (128 + 8));
-                        out[channel][pos] = ((rgbe[p + channelOffset] & 0xff) + 0.5f)
-                                * mult;
+                        out[channel][pos] = ((rgbe[p + channelOffset] & 0xff) + 0.5f) * mult;
                     }
                 }
             }

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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -208,19 +208,19 @@ public class TiffImageParser extends Ima
         if (unitsPerInch > 0) {
             if ((xResolutionField != null)
                     && (xResolutionField.getValue() != null)) {
-                final double XResolutionPixelsPerUnit = xResolutionField
+                final double xResolutionPixelsPerUnit = xResolutionField
                         .getDoubleValue();
                 physicalWidthDpi = (int) Math
-                        .round((XResolutionPixelsPerUnit * unitsPerInch));
-                physicalWidthInch = (float) (width / (XResolutionPixelsPerUnit * unitsPerInch));
+                        .round((xResolutionPixelsPerUnit * unitsPerInch));
+                physicalWidthInch = (float) (width / (xResolutionPixelsPerUnit * unitsPerInch));
             }
             if ((yResolutionField != null)
                     && (yResolutionField.getValue() != null)) {
-                final double YResolutionPixelsPerUnit = yResolutionField
+                final double yResolutionPixelsPerUnit = yResolutionField
                         .getDoubleValue();
                 physicalHeightDpi = (int) Math
-                        .round((YResolutionPixelsPerUnit * unitsPerInch));
-                physicalHeightInch = (float) (height / (YResolutionPixelsPerUnit * unitsPerInch));
+                        .round((yResolutionPixelsPerUnit * unitsPerInch));
+                physicalHeightInch = (float) (height / (yResolutionPixelsPerUnit * unitsPerInch));
             }
         }
 
@@ -687,12 +687,12 @@ public class TiffImageParser extends Ima
                     TiffTagConstants.TIFF_TAG_COLOR_MAP, true)
                     .getIntArrayValue();
 
-            final int expected_colormap_size = 3 * (1 << bitsPerPixel);
+            final int expectedColormapSize = 3 * (1 << bitsPerPixel);
 
-            if (colorMap.length != expected_colormap_size) {
+            if (colorMap.length != expectedColormapSize) {
                 throw new ImageReadException("Tiff: fColorMap.length ("
-                        + colorMap.length + ")!=expected_colormap_size ("
-                        + expected_colormap_size + ")");
+                        + colorMap.length + ")!=expectedColormapSize ("
+                        + expectedColormapSize + ")");
             }
 
             return new PhotometricInterpreterPalette(samplesPerPixel,

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java Wed Nov 27 11:21:14 2013
@@ -69,15 +69,14 @@ public class TiffReader extends BinaryFi
         }
     }
 
-    private TiffHeader readTiffHeader(final InputStream is) throws ImageReadException,
-            IOException {
-        final int BYTE_ORDER_1 = readByte("BYTE_ORDER_1", is, "Not a Valid TIFF File");
-        final int BYTE_ORDER_2 = readByte("BYTE_ORDER_2", is, "Not a Valid TIFF File");
-        if (BYTE_ORDER_1 != BYTE_ORDER_2) {
-            throw new ImageReadException("Byte Order bytes don't match (" + BYTE_ORDER_1
-                    + ", " + BYTE_ORDER_2 + ").");
+    private TiffHeader readTiffHeader(final InputStream is) throws ImageReadException, IOException {
+        final int byteOrder1 = readByte("BYTE_ORDER_1", is, "Not a Valid TIFF File");
+        final int byteOrder2 = readByte("BYTE_ORDER_2", is, "Not a Valid TIFF File");
+        if (byteOrder1 != byteOrder2) {
+            throw new ImageReadException("Byte Order bytes don't match (" + byteOrder1 + ", " + byteOrder2 + ").");
         }
-        final ByteOrder byteOrder = getTiffByteOrder(BYTE_ORDER_1);
+
+        final ByteOrder byteOrder = getTiffByteOrder(byteOrder1);
         setByteOrder(byteOrder);
 
         final int tiffVersion = read2Bytes("tiffVersion", is, "Not a Valid TIFF File");
@@ -85,11 +84,9 @@ public class TiffReader extends BinaryFi
             throw new ImageReadException("Unknown Tiff Version: " + tiffVersion);
         }
 
-        final long offsetToFirstIFD = 0xFFFFffffL & read4Bytes("offsetToFirstIFD", is,
-                "Not a Valid TIFF File");
+        final long offsetToFirstIFD = 0xFFFFffffL & read4Bytes("offsetToFirstIFD", is, "Not a Valid TIFF File");
 
-        skipBytes(is, offsetToFirstIFD - 8,
-                "Not a Valid TIFF File: couldn't find IFDs");
+        skipBytes(is, offsetToFirstIFD - 8, "Not a Valid TIFF File: couldn't find IFDs");
 
         if (getDebug()) {
             System.out.println("");
@@ -147,8 +144,7 @@ public class TiffReader extends BinaryFi
 
             int entryCount;
             try {
-                entryCount = read2Bytes("DirectoryEntryCount", is,
-                        "Not a Valid TIFF File");
+                entryCount = read2Bytes("DirectoryEntryCount", is, "Not a Valid TIFF File");
             } catch (final IOException e) {
                 if (strict) {
                     throw e;
@@ -507,7 +503,7 @@ public class TiffReader extends BinaryFi
         // check if the last read byte is actually the end of the image data
         if (strict &&
                 (length < 2 ||
-                (((data[data.length - 2] & 0xff) << 8) | (data[data.length - 1] & 0xff)) != JpegConstants.EOIMarker)) {
+                (((data[data.length - 2] & 0xff) << 8) | (data[data.length - 1] & 0xff)) != JpegConstants.EOI_MARKER)) {
             throw new ImageReadException("JPEG EOI marker could not be found at expected location");
         }
         return new JpegImageData(offset, length, data);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/BitInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/BitInputStream.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/BitInputStream.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/BitInputStream.java Wed Nov 27 11:21:14 2013
@@ -30,7 +30,7 @@ class BitInputStream extends InputStream
     private final ByteOrder byteOrder;
     private int cache;
     private int cacheBitsRemaining = 0;
-    private long bytes_read = 0;
+    private long bytesRead = 0;
 
     public BitInputStream(final InputStream is, final ByteOrder byteOrder) {
         this.is = is;
@@ -51,7 +51,7 @@ class BitInputStream extends InputStream
                 // fill cache
                 cache = is.read();
                 cacheBitsRemaining = 8;
-                bytes_read++;
+                bytesRead++;
             }
             if (count > cacheBitsRemaining) {
                 throw new IOException(
@@ -85,7 +85,7 @@ class BitInputStream extends InputStream
         }
 
         if (count == 8) {
-            bytes_read++;
+            bytesRead++;
             return is.read();
         }
 
@@ -96,33 +96,33 @@ class BitInputStream extends InputStream
          */
         if (byteOrder == ByteOrder.BIG_ENDIAN) {
             if (count == 16) {
-                bytes_read += 2;
+                bytesRead += 2;
                 return (is.read() << 8) | (is.read() << 0);
             }
 
             if (count == 24) {
-                bytes_read += 3;
+                bytesRead += 3;
                 return (is.read() << 16) | (is.read() << 8) | (is.read() << 0);
             }
 
             if (count == 32) {
-                bytes_read += 4;
+                bytesRead += 4;
                 return (is.read() << 24) | (is.read() << 16) | (is.read() << 8)
                         | (is.read() << 0);
             }
         } else {
             if (count == 16) {
-                bytes_read += 2;
+                bytesRead += 2;
                 return ((is.read() << 0) | (is.read() << 8));
             }
 
             if (count == 24) {
-                bytes_read += 3;
+                bytesRead += 3;
                 return ((is.read() << 0) | (is.read() << 8) | (is.read() << 16));
             }
 
             if (count == 32) {
-                bytes_read += 4;
+                bytesRead += 4;
                 return ((is.read() << 0) | (is.read() << 8) | (is.read() << 16) | (is
                         .read() << 24));
             }
@@ -136,6 +136,6 @@ class BitInputStream extends InputStream
     }
 
     public long getBytesRead() {
-        return bytes_read;
+        return bytesRead;
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java Wed Nov 27 11:21:14 2013
@@ -114,7 +114,7 @@ public abstract class DataReader impleme
     }
 
     protected byte[] decompress(final byte[] compressed, final int compression,
-            final int expected_size, final int tileWidth, final int tileHeight)
+            final int expectedSize, final int tileWidth, final int tileHeight)
             throws ImageReadException, IOException {
         final TiffField fillOrderField = directory
                 .findField(TiffTagConstants.TIFF_TAG_FILL_ORDER);
@@ -180,19 +180,19 @@ public abstract class DataReader impleme
         {
             final InputStream is = new ByteArrayInputStream(compressed);
 
-            final int LZWMinimumCodeSize = 8;
+            final int lzwMinimumCodeSize = 8;
 
             final MyLzwDecompressor myLzwDecompressor = new MyLzwDecompressor(
-                    LZWMinimumCodeSize, ByteOrder.BIG_ENDIAN);
+                    lzwMinimumCodeSize, ByteOrder.BIG_ENDIAN);
 
             myLzwDecompressor.setTiffLZWMode();
 
-            return myLzwDecompressor.decompress(is, expected_size);
+            return myLzwDecompressor.decompress(is, expectedSize);
         }
 
         case TIFF_COMPRESSION_PACKBITS: // Packbits
         {
-            return new PackBits().decompress(compressed, expected_size);
+            return new PackBits().decompress(compressed, expectedSize);
         }
 
         default:

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java Wed Nov 27 11:21:14 2013
@@ -56,7 +56,7 @@ public final class DataReaderStrips exte
     private void interpretStrip(
             final ImageBuilder imageBuilder, 
             final byte[] bytes,
-            final int pixels_per_strip,
+            final int pixelsPerStrip,
             final int yLimit) throws ImageReadException, IOException {
         if (y >= yLimit) {
             return;
@@ -114,7 +114,7 @@ public final class DataReaderStrips exte
 
         if (predictor != 2 && bitsPerPixel == 8 && allSamplesAreOneByte) {
             int k = 0;
-            int nRows = pixels_per_strip / width;
+            int nRows = pixelsPerStrip / width;
             if (y + nRows > yLimit) {
                 nRows = yLimit - y;
             }
@@ -133,7 +133,7 @@ public final class DataReaderStrips exte
             return;
         } else if (predictor != 2 && bitsPerPixel == 24 && allSamplesAreOneByte) {
             int k = 0;
-            int nRows = pixels_per_strip / width;
+            int nRows = pixelsPerStrip / width;
             if (y + nRows > yLimit) {
                 nRows = yLimit - y;
             }
@@ -176,7 +176,7 @@ public final class DataReaderStrips exte
 
         int[] samples = new int[bitsPerSample.length];
         resetPredictor();
-        for (int i = 0; i < pixels_per_strip; i++) {
+        for (int i = 0; i < pixelsPerStrip; i++) {
             getSamplesAsBytes(bis, samples);
 
             if (x < width) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterBase.java Wed Nov 27 11:21:14 2013
@@ -509,11 +509,11 @@ public abstract class TiffImageWriterBas
         { // Write Strips
             result = new byte[stripCount][];
 
-            int remaining_rows = height;
+            int remainingRows = height;
 
             for (int i = 0; i < stripCount; i++) {
-                final int rowsInStrip = Math.min(rowsPerStrip, remaining_rows);
-                remaining_rows -= rowsInStrip;
+                final int rowsInStrip = Math.min(rowsPerStrip, remainingRows);
+                remainingRows -= rowsInStrip;
 
                 final int bitsInRow = bitsPerSample * samplesPerPixel * width;
                 final int bytesPerRow = (bitsInRow + 7) / 8;

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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -352,7 +352,7 @@ public class XbmImageParser extends Imag
                 .getBytes("US-ASCII"));
 
         int bitcache = 0;
-        int bits_in_cache = 0;
+        int bitsInCache = 0;
         String separator = "\n  ";
         int written = 0;
         for (int y = 0; y < src.getHeight(); y++) {
@@ -367,9 +367,9 @@ public class XbmImageParser extends Imag
                 } else {
                     sample = 1;
                 }
-                bitcache |= (sample << bits_in_cache);
-                ++bits_in_cache;
-                if (bits_in_cache == 8) {
+                bitcache |= (sample << bitsInCache);
+                ++bitsInCache;
+                if (bitsInCache == 8) {
                     os.write(separator.getBytes("US-ASCII"));
                     separator = ",";
                     if (written == 12) {
@@ -378,11 +378,11 @@ public class XbmImageParser extends Imag
                     }
                     os.write(toPrettyHex(bitcache).getBytes("US-ASCII"));
                     bitcache = 0;
-                    bits_in_cache = 0;
+                    bitsInCache = 0;
                     ++written;
                 }
             }
-            if (bits_in_cache != 0) {
+            if (bitsInCache != 0) {
                 os.write(separator.getBytes("US-ASCII"));
                 separator = ",";
                 if (written == 12) {
@@ -391,7 +391,7 @@ public class XbmImageParser extends Imag
                 }
                 os.write(toPrettyHex(bitcache).getBytes("US-ASCII"));
                 bitcache = 0;
-                bits_in_cache = 0;
+                bitsInCache = 0;
                 ++written;
             }
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java Wed Nov 27 11:21:14 2013
@@ -25,45 +25,45 @@ import org.apache.commons.imaging.ImageR
 public class IccProfileInfo {
 
     private final byte[] data;
-    public final int ProfileSize;
-    public final int CMMTypeSignature;
-    public final int ProfileVersion;
-    public final int ProfileDeviceClassSignature;
-    public final int ColorSpace;
-    public final int ProfileConnectionSpace;
-    public final int ProfileFileSignature;
-    public final int PrimaryPlatformSignature;
-    public final int VariousFlags;
-    public final int DeviceManufacturer;
-    public final int DeviceModel;
-    public final int RenderingIntent;
-    public final int ProfileCreatorSignature;
-    private final byte[] ProfileID;
+    public final int profileSize;
+    public final int cmmTypeSignature;
+    public final int profileVersion;
+    public final int profileDeviceClassSignature;
+    public final int colorSpace;
+    public final int profileConnectionSpace;
+    public final int profileFileSignature;
+    public final int primaryPlatformSignature;
+    public final int variousFlags;
+    public final int deviceManufacturer;
+    public final int deviceModel;
+    public final int renderingIntent;
+    public final int profileCreatorSignature;
+    private final byte[] profileId;
     private final IccTag[] tags;
 
-    public IccProfileInfo(final byte[] data, final int ProfileSize, final int CMMTypeSignature,
-            final int ProfileVersion, final int ProfileDeviceClassSignature,
-            final int ColorSpace, final int ProfileConnectionSpace,
-            final int ProfileFileSignature, final int PrimaryPlatformSignature,
-            final int VariousFlags, final int DeviceManufacturer, final int DeviceModel,
-            final int RenderingIntent, final int ProfileCreatorSignature, final byte[] ProfileID,
+    public IccProfileInfo(final byte[] data, final int profileSize, final int cmmTypeSignature,
+            final int profileVersion, final int profileDeviceClassSignature,
+            final int colorSpace, final int profileConnectionSpace,
+            final int profileFileSignature, final int primaryPlatformSignature,
+            final int variousFlags, final int deviceManufacturer, final int deviceModel,
+            final int renderingIntent, final int profileCreatorSignature, final byte[] profileId,
             final IccTag[] tags) {
         this.data = data;
 
-        this.ProfileSize = ProfileSize;
-        this.CMMTypeSignature = CMMTypeSignature;
-        this.ProfileVersion = ProfileVersion;
-        this.ProfileDeviceClassSignature = ProfileDeviceClassSignature;
-        this.ColorSpace = ColorSpace;
-        this.ProfileConnectionSpace = ProfileConnectionSpace;
-        this.ProfileFileSignature = ProfileFileSignature;
-        this.PrimaryPlatformSignature = PrimaryPlatformSignature;
-        this.VariousFlags = VariousFlags;
-        this.DeviceManufacturer = DeviceManufacturer;
-        this.DeviceModel = DeviceModel;
-        this.RenderingIntent = RenderingIntent;
-        this.ProfileCreatorSignature = ProfileCreatorSignature;
-        this.ProfileID = ProfileID;
+        this.profileSize = profileSize;
+        this.cmmTypeSignature = cmmTypeSignature;
+        this.profileVersion = profileVersion;
+        this.profileDeviceClassSignature = profileDeviceClassSignature;
+        this.colorSpace = colorSpace;
+        this.profileConnectionSpace = profileConnectionSpace;
+        this.profileFileSignature = profileFileSignature;
+        this.primaryPlatformSignature = primaryPlatformSignature;
+        this.variousFlags = variousFlags;
+        this.deviceManufacturer = deviceManufacturer;
+        this.deviceModel = deviceModel;
+        this.renderingIntent = renderingIntent;
+        this.profileCreatorSignature = profileCreatorSignature;
+        this.profileId = profileId;
 
         this.tags = tags;
     }
@@ -72,8 +72,8 @@ public class IccProfileInfo {
         return data;
     }
 
-    public byte[] getProfileID() {
-        return ProfileID;
+    public byte[] getProfileId() {
+        return profileId;
     }
 
     public IccTag[] getTags() {
@@ -81,8 +81,8 @@ public class IccProfileInfo {
     }
 
     public boolean issRGB() {
-        return DeviceManufacturer == IccConstants.IEC 
-                && DeviceModel == IccConstants.sRGB;
+        return deviceManufacturer == IccConstants.IEC 
+                && deviceModel == IccConstants.sRGB;
     }
 
     private void printCharQuad(final PrintWriter pw, final String msg, final int i) {
@@ -111,35 +111,18 @@ public class IccProfileInfo {
 
         pw.println(prefix + ": " + "data length: " + data.length);
 
-        printCharQuad(pw, prefix + ": " + "ProfileDeviceClassSignature",
-                ProfileDeviceClassSignature);
-
-        printCharQuad(pw, prefix + ": " + "CMMTypeSignature", CMMTypeSignature);
-
-        printCharQuad(pw, prefix + ": " + "ProfileDeviceClassSignature",
-                ProfileDeviceClassSignature);
-        printCharQuad(pw, prefix + ": " + "ColorSpace", ColorSpace);
-        printCharQuad(pw, prefix + ": " + "ProfileConnectionSpace",
-                ProfileConnectionSpace);
-
-        printCharQuad(pw, prefix + ": " + "ProfileFileSignature",
-                ProfileFileSignature);
-
-        printCharQuad(pw, prefix + ": " + "PrimaryPlatformSignature",
-                PrimaryPlatformSignature);
-
-        printCharQuad(pw, prefix + ": " + "ProfileFileSignature",
-                ProfileFileSignature);
-
-        printCharQuad(pw, prefix + ": " + "DeviceManufacturer",
-                DeviceManufacturer);
-
-        printCharQuad(pw, prefix + ": " + "DeviceModel", DeviceModel);
-
-        printCharQuad(pw, prefix + ": " + "RenderingIntent", RenderingIntent);
-
-        printCharQuad(pw, prefix + ": " + "ProfileCreatorSignature",
-                ProfileCreatorSignature);
+        printCharQuad(pw, prefix + ": " + "ProfileDeviceClassSignature", profileDeviceClassSignature);
+        printCharQuad(pw, prefix + ": " + "CMMTypeSignature", cmmTypeSignature);
+        printCharQuad(pw, prefix + ": " + "ProfileDeviceClassSignature", profileDeviceClassSignature);
+        printCharQuad(pw, prefix + ": " + "ColorSpace", colorSpace);
+        printCharQuad(pw, prefix + ": " + "ProfileConnectionSpace", profileConnectionSpace);
+        printCharQuad(pw, prefix + ": " + "ProfileFileSignature", profileFileSignature);
+        printCharQuad(pw, prefix + ": " + "PrimaryPlatformSignature", primaryPlatformSignature);
+        printCharQuad(pw, prefix + ": " + "ProfileFileSignature", profileFileSignature);
+        printCharQuad(pw, prefix + ": " + "DeviceManufacturer", deviceManufacturer);
+        printCharQuad(pw, prefix + ": " + "DeviceModel", deviceModel);
+        printCharQuad(pw, prefix + ": " + "RenderingIntent", renderingIntent);
+        printCharQuad(pw, prefix + ": " + "ProfileCreatorSignature", profileCreatorSignature);
 
         for (int i = 0; i < tags.length; i++) {
             final IccTag tag = tags[i];

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java Wed Nov 27 11:21:14 2013
@@ -34,12 +34,12 @@ public class IccProfileParser extends Bi
         this.setByteOrder(ByteOrder.BIG_ENDIAN);
     }
 
-    public IccProfileInfo getICCProfileInfo(final ICC_Profile icc_profile) {
-        if (icc_profile == null) {
+    public IccProfileInfo getICCProfileInfo(final ICC_Profile iccProfile) {
+        if (iccProfile == null) {
             return null;
         }
 
-        return getICCProfileInfo(new ByteSourceArray(icc_profile.getData()));
+        return getICCProfileInfo(new ByteSourceArray(iccProfile.getData()));
     }
 
     public IccProfileInfo getICCProfileInfo(final byte[] bytes) {
@@ -120,8 +120,7 @@ public class IccProfileParser extends Bi
         // Debug.debug("length: " + length);
 
         try {
-            final int ProfileSize = read4Bytes("ProfileSize", is,
-                    "Not a Valid ICC Profile");
+            final int profileSize = read4Bytes("ProfileSize", is, "Not a Valid ICC Profile");
 
             // if (length != ProfileSize)
             // {
@@ -134,86 +133,71 @@ public class IccProfileParser extends Bi
             // return null;
             // }
 
-            final int CMMTypeSignature = read4Bytes("Signature", is,
-                    "Not a Valid ICC Profile");
+            final int cmmTypeSignature = read4Bytes("Signature", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("CMMTypeSignature", CMMTypeSignature);
+                printCharQuad("CMMTypeSignature", cmmTypeSignature);
             }
 
-            final int ProfileVersion = read4Bytes("ProfileVersion", is,
-                    "Not a Valid ICC Profile");
+            final int profileVersion = read4Bytes("ProfileVersion", is, "Not a Valid ICC Profile");
 
-            final int ProfileDeviceClassSignature = read4Bytes(
-                    "ProfileDeviceClassSignature", is,
+            final int profileDeviceClassSignature = read4Bytes("ProfileDeviceClassSignature", is, 
                     "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ProfileDeviceClassSignature",
-                        ProfileDeviceClassSignature);
+                printCharQuad("ProfileDeviceClassSignature", profileDeviceClassSignature);
             }
 
-            final int ColorSpace = read4Bytes("ColorSpace", is,
-                    "Not a Valid ICC Profile");
+            final int colorSpace = read4Bytes("ColorSpace", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ColorSpace", ColorSpace);
+                printCharQuad("ColorSpace", colorSpace);
             }
 
-            final int ProfileConnectionSpace = read4Bytes("ProfileConnectionSpace",
-                    is, "Not a Valid ICC Profile");
+            final int profileConnectionSpace = read4Bytes("ProfileConnectionSpace", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ProfileConnectionSpace", ProfileConnectionSpace);
+                printCharQuad("ProfileConnectionSpace", profileConnectionSpace);
             }
 
             skipBytes(is, 12, "Not a Valid ICC Profile");
 
-            final int ProfileFileSignature = read4Bytes("ProfileFileSignature", is,
-                    "Not a Valid ICC Profile");
+            final int profileFileSignature = read4Bytes("ProfileFileSignature", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ProfileFileSignature", ProfileFileSignature);
+                printCharQuad("ProfileFileSignature", profileFileSignature);
             }
 
-            final int PrimaryPlatformSignature = read4Bytes(
-                    "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
+            final int primaryPlatformSignature = read4Bytes( "PrimaryPlatformSignature", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("PrimaryPlatformSignature",
-                        PrimaryPlatformSignature);
+                printCharQuad("PrimaryPlatformSignature", primaryPlatformSignature);
             }
 
-            final int VariousFlags = read4Bytes("ProfileFileSignature", is,
-                    "Not a Valid ICC Profile");
+            final int variousFlags = read4Bytes("VariousFlags", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ProfileFileSignature", ProfileFileSignature);
+                printCharQuad("VariousFlags", profileFileSignature);
             }
 
-            final int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
-                    "Not a Valid ICC Profile");
+            final int deviceManufacturer = read4Bytes("DeviceManufacturer", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("DeviceManufacturer", DeviceManufacturer);
+                printCharQuad("DeviceManufacturer", deviceManufacturer);
             }
 
-            final int DeviceModel = read4Bytes("DeviceModel", is,
-                    "Not a Valid ICC Profile");
+            final int deviceModel = read4Bytes("DeviceModel", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("DeviceModel", DeviceModel);
+                printCharQuad("DeviceModel", deviceModel);
             }
 
             skipBytes(is, 8, "Not a Valid ICC Profile");
 
-            final int RenderingIntent = read4Bytes("RenderingIntent", is,
-                    "Not a Valid ICC Profile");
+            final int renderingIntent = read4Bytes("RenderingIntent", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("RenderingIntent", RenderingIntent);
+                printCharQuad("RenderingIntent", renderingIntent);
             }
 
             skipBytes(is, 12, "Not a Valid ICC Profile");
 
-            final int ProfileCreatorSignature = read4Bytes("ProfileCreatorSignature",
-                    is, "Not a Valid ICC Profile");
+            final int profileCreatorSignature = read4Bytes("ProfileCreatorSignature", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("ProfileCreatorSignature",
-                        ProfileCreatorSignature);
+                printCharQuad("ProfileCreatorSignature", profileCreatorSignature);
             }
 
-            final byte[] ProfileID = null;
+            final byte[] profileId = null;
             skipBytes(is, 16, "Not a Valid ICC Profile");
             // readByteArray("ProfileID", 16, is,
             // "Not a Valid ICC Profile");
@@ -225,24 +209,21 @@ public class IccProfileParser extends Bi
 
             // this.setDebug(true);
 
-            final int TagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");
+            final int tagCount = read4Bytes("TagCount", is, "Not a Valid ICC Profile");
 
             // List tags = new ArrayList();
-            final IccTag[] tags = new IccTag[TagCount];
+            final IccTag[] tags = new IccTag[tagCount];
 
-            for (int i = 0; i < TagCount; i++) {
-                final int TagSignature = read4Bytes("TagSignature[" + i + "]", is,
-                        "Not a Valid ICC Profile");
+            for (int i = 0; i < tagCount; i++) {
+                final int tagSignature = read4Bytes("TagSignature[" + i + "]", is, "Not a Valid ICC Profile");
                 // Debug.debug("TagSignature t "
                 // + Integer.toHexString(TagSignature));
 
                 // this.printCharQuad("TagSignature", TagSignature);
-                final int OffsetToData = read4Bytes("OffsetToData[" + i + "]", is,
-                        "Not a Valid ICC Profile");
-                final int ElementSize = read4Bytes("ElementSize[" + i + "]", is,
-                        "Not a Valid ICC Profile");
+                final int offsetToData = read4Bytes("OffsetToData[" + i + "]", is, "Not a Valid ICC Profile");
+                final int elementSize = read4Bytes("ElementSize[" + i + "]", is, "Not a Valid ICC Profile");
 
-                final IccTagType fIccTagType = getIccTagType(TagSignature);
+                final IccTagType fIccTagType = getIccTagType(tagSignature);
                 // if (fIccTagType == null)
                 // throw new Error("oops.");
 
@@ -255,8 +236,8 @@ public class IccProfileParser extends Bi
                 // : fIccTagType.name));
                 // Debug.debug();
 
-                final IccTag tag = new IccTag(TagSignature, OffsetToData,
-                        ElementSize, fIccTagType);
+                final IccTag tag = new IccTag(tagSignature, offsetToData,
+                        elementSize, fIccTagType);
                 // tag.dump("\t" + i + ": ");
                 tags[i] = tag;
                 // tags .add(tag);
@@ -270,17 +251,17 @@ public class IccProfileParser extends Bi
 
             final byte[] data = cis.getCache();
 
-            if (data.length < ProfileSize) {
+            if (data.length < profileSize) {
                 throw new IOException("Couldn't read ICC Profile.");
             }
 
-            final IccProfileInfo result = new IccProfileInfo(data, ProfileSize,
-                    CMMTypeSignature, ProfileVersion,
-                    ProfileDeviceClassSignature, ColorSpace,
-                    ProfileConnectionSpace, ProfileFileSignature,
-                    PrimaryPlatformSignature, VariousFlags, DeviceManufacturer,
-                    DeviceModel, RenderingIntent, ProfileCreatorSignature,
-                    ProfileID, tags);
+            final IccProfileInfo result = new IccProfileInfo(data, profileSize,
+                    cmmTypeSignature, profileVersion,
+                    profileDeviceClassSignature, colorSpace,
+                    profileConnectionSpace, profileFileSignature,
+                    primaryPlatformSignature, variousFlags, deviceManufacturer,
+                    deviceModel, renderingIntent, profileCreatorSignature,
+                    profileId, tags);
 
             if (getDebug()) {
                 Debug.debug("issRGB: " + result.issRGB());
@@ -304,8 +285,8 @@ public class IccProfileParser extends Bi
         return null;
     }
 
-    public boolean issRGB(final ICC_Profile icc_profile) throws IOException {
-        return issRGB(new ByteSourceArray(icc_profile.getData()));
+    public boolean issRGB(final ICC_Profile iccProfile) throws IOException {
+        return issRGB(new ByteSourceArray(iccProfile.getData()));
     }
 
     public boolean issRGB(final byte[] bytes) throws IOException {
@@ -344,19 +325,17 @@ public class IccProfileParser extends Bi
 
             this.skipBytes(is, 4 * 3);
 
-            final int DeviceManufacturer = read4Bytes("ProfileFileSignature", is,
-                    "Not a Valid ICC Profile");
+            final int deviceManufacturer = read4Bytes("ProfileFileSignature", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("DeviceManufacturer", DeviceManufacturer);
+                printCharQuad("DeviceManufacturer", deviceManufacturer);
             }
 
-            final int DeviceModel = read4Bytes("DeviceModel", is,
-                    "Not a Valid ICC Profile");
+            final int deviceModel = read4Bytes("DeviceModel", is, "Not a Valid ICC Profile");
             if (getDebug()) {
-                printCharQuad("DeviceModel", DeviceModel);
+                printCharQuad("DeviceModel", deviceModel);
             }
 
-            final boolean result = ((DeviceManufacturer == IccConstants.IEC) && (DeviceModel == IccConstants.sRGB));
+            boolean result = deviceManufacturer == IccConstants.IEC && deviceModel == IccConstants.sRGB;
             canThrow = true;
             return result;
         } finally {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java Wed Nov 27 11:21:14 2013
@@ -34,7 +34,7 @@ public class IccTag {
     public final IccTagType fIccTagType;
     public byte[] data;
     private IccTagDataType itdt;
-    private int data_type_signature;
+    private int dataTypeSignature;
 
     // public final byte[] data;
 
@@ -53,10 +53,10 @@ public class IccTag {
         try {
             bis = new BinaryInputStream(new ByteArrayInputStream(
                 bytes), ByteOrder.BIG_ENDIAN);
-            data_type_signature = bis.read4Bytes("data type signature",
+            dataTypeSignature = bis.read4Bytes("data type signature",
                     "ICC: corrupt tag data");
     
-            itdt = getIccTagDataType(data_type_signature);
+            itdt = getIccTagDataType(dataTypeSignature);
             // if (itdt != null)
             // {
             // System.out.println("\t\t\t" + "itdt: " + itdt.name);
@@ -105,13 +105,13 @@ public class IccTag {
 
             pw.println(prefix
                     + "data type signature: "
-                    + Integer.toHexString(data_type_signature)
+                    + Integer.toHexString(dataTypeSignature)
                     + " ("
                     + new String(new byte[] {
-                            (byte) (0xff & (data_type_signature >> 24)),
-                            (byte) (0xff & (data_type_signature >> 16)),
-                            (byte) (0xff & (data_type_signature >> 8)),
-                            (byte) (0xff & (data_type_signature >> 0)), }, "US-ASCII")
+                            (byte) (0xff & (dataTypeSignature >> 24)),
+                            (byte) (0xff & (dataTypeSignature >> 16)),
+                            (byte) (0xff & (dataTypeSignature >> 8)),
+                            (byte) (0xff & (dataTypeSignature >> 0)), }, "US-ASCII")
                     + ")");
 
             if (itdt == null) {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagDataTypes.java Wed Nov 27 11:21:14 2013
@@ -40,11 +40,10 @@ public enum IccTagDataTypes implements I
     
                 //            bis.setDebug(true);
                 bis.read4Bytes("ignore", "ICC: corrupt tag data");
-                final int string_length = bis.read4Bytes("string_length",
-                        "ICC: corrupt tag data");
+                final int stringLength = bis.read4Bytes("stringLength", "ICC: corrupt tag data");
     
                 //            bis.readByteArray("ignore", bytes.length -12, "none");
-                final String s = new String(bytes, 12, string_length - 1, "US-ASCII");
+                final String s = new String(bytes, 12, stringLength - 1, "US-ASCII");
                 System.out.println(prefix + "s: '" + s + "'");
                 canThrow = true;
             } finally {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTagTypes.java Wed Nov 27 11:21:14 2013
@@ -25,7 +25,7 @@ public enum IccTagTypes implements IccTa
     //    public static final IccTagType AToB0Tag = new IccTagType(
     //    "AToB0Tag",
     //    "lut8Type or lut16Type or lutAtoBType",
-    //    "‘A2B0’ (41324230h)",
+    //    "�A2B0� (41324230h)",
     //    "This tag defines a color transform from Device to PCS using lookup table tag element structures. The processing",
     //    "mechanisms are described in lut8Type or lut16Type or lutAtoBType.",
     //    );
@@ -73,8 +73,8 @@ public enum IccTagTypes implements IccTa
 
     CALIBRATION_DATE_TIME_TAG(
             "calibrationDateTimeTag", "dateTimeType", 0x63616C74
-    //    "Profile calibration date and time. Initially, this tag matches the contents of the profile header’s creation",
-    //    "date/time field. This allows applications and utilities to verify if this profile matches a vendor’s profile and",
+    //    "Profile calibration date and time. Initially, this tag matches the contents of the profile header�s creation",
+    //    "date/time field. This allows applications and utilities to verify if this profile matches a vendor�s profile and",
     //    "how recently calibration has been performed.",
     ),
 
@@ -124,7 +124,7 @@ public enum IccTagTypes implements IccTa
     //    "the chromatically adapted value in the PCS.",
     //    "The chromatic adaptation matrix is a combination of three separate conversions:",
     //    "1) Conversion of source CIE XYZ tristimulus values to cone response tristimulus values.",
-    //    "2) Adjustment of the cone response values for an observer’s chromatic adaptation.",
+    //    "2) Adjustment of the cone response values for an observer�s chromatic adaptation.",
     //    "3) Conversion of the adjusted cone response tristimulus back to CIE XYZ values.",
     ),
 
@@ -166,8 +166,8 @@ public enum IccTagTypes implements IccTa
             "lut8Type or lut16Type or lutBtoAType", 0x67616D74
     //    "Out of gamut tag. The processing mechanisms are described in lut8Type or lut16Type or lutBtoAType.",
     //    "This tag takes PCS values as its input and produces a single channel of output. If the output value is 0, the",
-    //    "PCS color is in-gamut. If the output is non-zero, the PCS color is out-of-gamut, with the output value “n+1”",
-    //    "being at least as far out of gamut as the output value “n”.",
+    //    "PCS color is in-gamut. If the output is non-zero, the PCS color is out-of-gamut, with the output value �n+1�",
+    //    "being at least as far out of gamut as the output value �n�.",
     ),
 
     GRAY_TRC_TAG("grayTRCTag",
@@ -234,7 +234,7 @@ public enum IccTagTypes implements IccTa
             "outputResponseTag", "responseCurveSet16Type", 0x72657370
     //    "Structure containing a description of the device response for which the profile is intended. The content of",
     //    "this structure is described in 6.5.16.",
-    //    "NOTE The user’s attention is called to the possibility that the use of this tag for device calibration may",
+    //    "NOTE The user�s attention is called to the possibility that the use of this tag for device calibration may",
     //    "require use of an invention covered by patent rights. By publication of this specification, no position is",
     //    "taken with respect to the validity of this claim or of any patent rights in connection therewith. The patent",
     //    "holder has, however, filed a statement of willingness to grant a license under these rights on reasonable",
@@ -315,12 +315,12 @@ public enum IccTagTypes implements IccTa
     );
 
     public final String name;
-    public final String type_description;
+    public final String typeDescription;
     public final int signature;
 
-    IccTagTypes(final String name, final String type_description, final int signature) {
+    IccTagTypes(final String name, final String typeDescription, final int signature) {
         this.name = name;
-        this.type_description = type_description;
+        this.typeDescription = typeDescription;
         this.signature = signature;
     }
 
@@ -329,7 +329,7 @@ public enum IccTagTypes implements IccTa
     }
     
     public String getTypeDescription() {
-        return type_description;
+        return typeDescription;
     }
     
     public int getSignature() {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java Wed Nov 27 11:21:14 2013
@@ -24,61 +24,61 @@ class ColorGroup {
     // public final ColorGroup parent;
     public ColorGroupCut cut = null;
     // public final List children = new ArrayList();
-    public int palette_index = -1;
+    public int paletteIndex = -1;
 
-    public final List<ColorCount> color_counts;
+    public final List<ColorCount> colorCounts;
     public final boolean ignoreAlpha;
-    public int min_red = Integer.MAX_VALUE;
-    public int max_red = Integer.MIN_VALUE;
-    public int min_green = Integer.MAX_VALUE;
-    public int max_green = Integer.MIN_VALUE;
-    public int min_blue = Integer.MAX_VALUE;
-    public int max_blue = Integer.MIN_VALUE;
-    public int min_alpha = Integer.MAX_VALUE;
-    public int max_alpha = Integer.MIN_VALUE;
-
-    public final int alpha_diff;
-    public final int red_diff;
-    public final int green_diff;
-    public final int blue_diff;
+    public int minRed = Integer.MAX_VALUE;
+    public int maxRed = Integer.MIN_VALUE;
+    public int minGreen = Integer.MAX_VALUE;
+    public int maxGreen = Integer.MIN_VALUE;
+    public int minBlue = Integer.MAX_VALUE;
+    public int maxBlue = Integer.MIN_VALUE;
+    public int minAlpha = Integer.MAX_VALUE;
+    public int maxAlpha = Integer.MIN_VALUE;
+
+    public final int alphaDiff;
+    public final int redDiff;
+    public final int greenDiff;
+    public final int blueDiff;
 
-    public final int max_diff;
-    public final int diff_total;
+    public final int maxDiff;
+    public final int diffTotal;
     public final int totalPoints;
 
-    public ColorGroup(final List<ColorCount> color_counts, final boolean ignoreAlpha)
+    public ColorGroup(final List<ColorCount> colorCounts, final boolean ignoreAlpha)
             throws ImageWriteException {
-        this.color_counts = color_counts;
+        this.colorCounts = colorCounts;
         this.ignoreAlpha = ignoreAlpha;
 
-        if (color_counts.size() < 1) {
+        if (colorCounts.size() < 1) {
             throw new ImageWriteException("empty color_group");
         }
 
         int total = 0;
-        for (ColorCount color : color_counts) {
+        for (ColorCount color : colorCounts) {
             total += color.count;
 
-            min_alpha = Math.min(min_alpha, color.alpha);
-            max_alpha = Math.max(max_alpha, color.alpha);
-            min_red = Math.min(min_red, color.red);
-            max_red = Math.max(max_red, color.red);
-            min_green = Math.min(min_green, color.green);
-            max_green = Math.max(max_green, color.green);
-            min_blue = Math.min(min_blue, color.blue);
-            max_blue = Math.max(max_blue, color.blue);
+            minAlpha = Math.min(minAlpha, color.alpha);
+            maxAlpha = Math.max(maxAlpha, color.alpha);
+            minRed = Math.min(minRed, color.red);
+            maxRed = Math.max(maxRed, color.red);
+            minGreen = Math.min(minGreen, color.green);
+            maxGreen = Math.max(maxGreen, color.green);
+            minBlue = Math.min(minBlue, color.blue);
+            maxBlue = Math.max(maxBlue, color.blue);
         }
         this.totalPoints = total;
 
-        alpha_diff = max_alpha - min_alpha;
-        red_diff = max_red - min_red;
-        green_diff = max_green - min_green;
-        blue_diff = max_blue - min_blue;
-        max_diff = Math.max(
-                ignoreAlpha ? red_diff : Math.max(alpha_diff, red_diff),
-                Math.max(green_diff, blue_diff));
-        diff_total = (ignoreAlpha ? 0 : alpha_diff) + red_diff + green_diff
-                + blue_diff;
+        alphaDiff = maxAlpha - minAlpha;
+        redDiff = maxRed - minRed;
+        greenDiff = maxGreen - minGreen;
+        blueDiff = maxBlue - minBlue;
+        maxDiff = Math.max(
+                ignoreAlpha ? redDiff : Math.max(alphaDiff, redDiff),
+                Math.max(greenDiff, blueDiff));
+        diffTotal = (ignoreAlpha ? 0 : alphaDiff) + redDiff + greenDiff
+                + blueDiff;
 
     }
 
@@ -88,54 +88,54 @@ class ColorGroup {
         final int green = 0xff & (argb >> 8);
         final int blue = 0xff & (argb >> 0);
 
-        if (!ignoreAlpha && (alpha < min_alpha || alpha > max_alpha)) {
+        if (!ignoreAlpha && (alpha < minAlpha || alpha > maxAlpha)) {
             return false;
         }
-        if (red < min_red || red > max_red) {
+        if (red < minRed || red > maxRed) {
             return false;
         }
-        if (green < min_green || green > max_green) {
+        if (green < minGreen || green > maxGreen) {
             return false;
         }
-        if (blue < min_blue || blue > max_blue) {
+        if (blue < minBlue || blue > maxBlue) {
             return false;
         }
         return true;
     }
 
     public int getMedianValue() {
-        long count_total = 0;
-        long alpha_total = 0, red_total = 0, green_total = 0, blue_total = 0;
+        long countTotal = 0;
+        long alphaTotal = 0, redTotal = 0, greenTotal = 0, blueTotal = 0;
 
-        for (ColorCount color : color_counts) {
-            count_total += color.count;
-            alpha_total += color.count * color.alpha;
-            red_total += color.count * color.red;
-            green_total += color.count * color.green;
-            blue_total += color.count * color.blue;
+        for (ColorCount color : colorCounts) {
+            countTotal += color.count;
+            alphaTotal += color.count * color.alpha;
+            redTotal += color.count * color.red;
+            greenTotal += color.count * color.green;
+            blueTotal += color.count * color.blue;
         }
 
         final int alpha = ignoreAlpha ? 0xff : (int) Math
-                .round((double) alpha_total / count_total);
-        final int red = (int) Math.round((double) red_total / count_total);
-        final int green = (int) Math.round((double) green_total / count_total);
-        final int blue = (int) Math.round((double) blue_total / count_total);
+                .round((double) alphaTotal / countTotal);
+        final int red = (int) Math.round((double) redTotal / countTotal);
+        final int green = (int) Math.round((double) greenTotal / countTotal);
+        final int blue = (int) Math.round((double) blueTotal / countTotal);
 
         return (alpha << 24) | (red << 16) | (green << 8) | blue;
     }
 
     @Override
     public String toString() {
-        return "{ColorGroup. min_red: " + Integer.toHexString(min_red)
-                + ", max_red: " + Integer.toHexString(max_red)
-                + ", min_green: " + Integer.toHexString(min_green)
-                + ", max_green: " + Integer.toHexString(max_green)
-                + ", min_blue: " + Integer.toHexString(min_blue)
-                + ", max_blue: " + Integer.toHexString(max_blue)
-                + ", min_alpha: " + Integer.toHexString(min_alpha)
-                + ", max_alpha: " + Integer.toHexString(max_alpha)
-                + ", max_diff: " + Integer.toHexString(max_diff)
-                + ", diff_total: " + diff_total + "}";
+        return "{ColorGroup. minRed: " + Integer.toHexString(minRed)
+                + ", maxRed: " + Integer.toHexString(maxRed)
+                + ", minGreen: " + Integer.toHexString(minGreen)
+                + ", maxGreen: " + Integer.toHexString(maxGreen)
+                + ", minBlue: " + Integer.toHexString(minBlue)
+                + ", maxBlue: " + Integer.toHexString(maxBlue)
+                + ", minAlpha: " + Integer.toHexString(minAlpha)
+                + ", maxAlpha: " + Integer.toHexString(maxAlpha)
+                + ", maxDiff: " + Integer.toHexString(maxDiff)
+                + ", diffTotal: " + diffTotal + "}";
     }
 
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java Wed Nov 27 11:21:14 2013
@@ -23,23 +23,23 @@ class ColorSpaceSubset {
     final int[] mins;
     final int[] maxs;
     final int precision;
-    final int precision_mask;
+    final int precisionMask;
     final int total;
     int rgb; // median
     // the index in the palette.
     private int index;
-    public static final RgbComparator rgbComparator = new RgbComparator();
+    public static final RgbComparator RGB_COMPARATOR = new RgbComparator();
 
     ColorSpaceSubset(final int total, final int precision) {
         this.total = total;
         this.precision = precision;
-        precision_mask = (1 << precision) - 1;
+        precisionMask = (1 << precision) - 1;
 
         mins = new int[PaletteFactory.COMPONENTS];
         maxs = new int[PaletteFactory.COMPONENTS];
         for (int i = 0; i < PaletteFactory.COMPONENTS; i++) {
             mins[i] = 0;
-            maxs[i] = precision_mask;
+            maxs[i] = precisionMask;
         }
 
         rgb = -1;
@@ -50,7 +50,7 @@ class ColorSpaceSubset {
         this.precision = precision;
         this.mins = mins;
         this.maxs = maxs;
-        precision_mask = (1 << precision) - 1;
+        precisionMask = (1 << precision) - 1;
 
         rgb = -1;
     }
@@ -87,7 +87,7 @@ class ColorSpaceSubset {
         final int rdiff = maxs[0] - mins[0] + 1;
         final int gdiff = maxs[1] - mins[1] + 1;
         final int bdiff = maxs[2] - mins[2] + 1;
-        final int color_area = rdiff * gdiff * bdiff;
+        final int colorArea = rdiff * gdiff * bdiff;
 
         System.out.println(prefix + ": [" + Integer.toHexString(rgb)
                 + "] total : " + total
@@ -107,8 +107,8 @@ class ColorSpaceSubset {
                 + mins[2] + ", " + maxs[2]);
         System.out
                 .println("\t" + "rdiff: " + rdiff + ", " + "gdiff: " + gdiff
-                        + ", " + "bdiff: " + bdiff + ", " + "color_area: "
-                        + color_area);
+                        + ", " + "bdiff: " + bdiff + ", " + "colorArea: "
+                        + colorArea);
     }
 
     public void dumpJustRGB(final String prefix) {
@@ -125,9 +125,9 @@ class ColorSpaceSubset {
         final int rdiff = maxs[0] - mins[0] + 1;
         final int gdiff = maxs[1] - mins[1] + 1;
         final int bdiff = maxs[2] - mins[2] + 1;
-        final int color_area = rdiff * gdiff * bdiff;
+        final int colorArea = rdiff * gdiff * bdiff;
 
-        return color_area;
+        return colorArea;
 
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java Wed Nov 27 11:21:14 2013
@@ -24,42 +24,42 @@ import java.util.List;
 import org.apache.commons.imaging.ImageWriteException;
 
 public class MedianCutLongestAxisImplementation extends MedianCutImplementation {
-    private static final Comparator<ColorGroup> comparator = new Comparator<ColorGroup>() {
+    private static final Comparator<ColorGroup> COMPARATOR = new Comparator<ColorGroup>() {
         public int compare(final ColorGroup cg1, final ColorGroup cg2) {
-            if (cg1.max_diff == cg2.max_diff) {
-                return cg2.diff_total - cg1.diff_total;
+            if (cg1.maxDiff == cg2.maxDiff) {
+                return cg2.diffTotal - cg1.diffTotal;
             }
-            return cg2.max_diff - cg1.max_diff;
+            return cg2.maxDiff - cg1.maxDiff;
         }
     };
 
     @Override
-    public boolean performNextMedianCut(final List<ColorGroup> color_groups, final boolean ignoreAlpha)
+    public boolean performNextMedianCut(final List<ColorGroup> colorGroups, final boolean ignoreAlpha)
             throws ImageWriteException {
-        Collections.sort(color_groups, comparator);
-        final ColorGroup color_group = color_groups.get(0);
+        Collections.sort(colorGroups, COMPARATOR);
+        final ColorGroup colorGroup = colorGroups.get(0);
 
-        if (color_group.max_diff == 0) {
+        if (colorGroup.maxDiff == 0) {
             return false;
         }
         if (!ignoreAlpha
-                && color_group.alpha_diff > color_group.red_diff
-                && color_group.alpha_diff > color_group.green_diff
-                && color_group.alpha_diff > color_group.blue_diff) {
-            doCut(color_group, ColorComponent.ALPHA, color_groups, ignoreAlpha);
-        } else if (color_group.red_diff > color_group.green_diff
-                && color_group.red_diff > color_group.blue_diff) {
-            doCut(color_group, ColorComponent.RED, color_groups, ignoreAlpha);
-        } else if (color_group.green_diff > color_group.blue_diff) {
-            doCut(color_group, ColorComponent.GREEN, color_groups, ignoreAlpha);
+                && colorGroup.alphaDiff > colorGroup.redDiff
+                && colorGroup.alphaDiff > colorGroup.greenDiff
+                && colorGroup.alphaDiff > colorGroup.blueDiff) {
+            doCut(colorGroup, ColorComponent.ALPHA, colorGroups, ignoreAlpha);
+        } else if (colorGroup.redDiff > colorGroup.greenDiff
+                && colorGroup.redDiff > colorGroup.blueDiff) {
+            doCut(colorGroup, ColorComponent.RED, colorGroups, ignoreAlpha);
+        } else if (colorGroup.greenDiff > colorGroup.blueDiff) {
+            doCut(colorGroup, ColorComponent.GREEN, colorGroups, ignoreAlpha);
         } else {
-            doCut(color_group, ColorComponent.BLUE, color_groups, ignoreAlpha);
+            doCut(colorGroup, ColorComponent.BLUE, colorGroups, ignoreAlpha);
         }
         return true;
     }
     
-    private void doCut(final ColorGroup color_group, final ColorComponent mode,
-            final List<ColorGroup> color_groups, final boolean ignoreAlpha) throws ImageWriteException {
+    private void doCut(final ColorGroup colorGroup, final ColorComponent mode,
+            final List<ColorGroup> colorGroups, final boolean ignoreAlpha) throws ImageWriteException {
 
         final Comparator<ColorCount> comp = new Comparator<ColorCount>() {
             public int compare(final ColorCount c1, final ColorCount c2) {
@@ -78,64 +78,64 @@ public class MedianCutLongestAxisImpleme
             }
         };
 
-        Collections.sort(color_group.color_counts, comp);
-        final int count_half = (int) Math.round((double) color_group.totalPoints / 2);
-        int old_count = 0, new_count = 0;
-        int median_index;
-        for (median_index = 0; median_index < color_group.color_counts.size(); median_index++) {
-            final ColorCount color_count = color_group.color_counts.get(median_index);
+        Collections.sort(colorGroup.colorCounts, comp);
+        final int countHalf = (int) Math.round((double) colorGroup.totalPoints / 2);
+        int oldCount = 0, newCount = 0;
+        int medianIndex;
+        for (medianIndex = 0; medianIndex < colorGroup.colorCounts.size(); medianIndex++) {
+            final ColorCount colorCount = colorGroup.colorCounts.get(medianIndex);
 
-            new_count += color_count.count;
+            newCount += colorCount.count;
 
-            if (new_count < count_half) {
-                old_count = new_count;
+            if (newCount < countHalf) {
+                oldCount = newCount;
             } else {
                 break;
             }
         }
 
-        if (median_index == color_group.color_counts.size() - 1) {
-            median_index--;
-        } else if (median_index > 0) {
-            final int new_diff = Math.abs(new_count - count_half);
-            final int old_diff = Math.abs(count_half - old_count);
-            if (old_diff < new_diff) {
-                median_index--;
+        if (medianIndex == colorGroup.colorCounts.size() - 1) {
+            medianIndex--;
+        } else if (medianIndex > 0) {
+            final int newDiff = Math.abs(newCount - countHalf);
+            final int oldDiff = Math.abs(countHalf - oldCount);
+            if (oldDiff < newDiff) {
+                medianIndex--;
             }
         }
 
-        color_groups.remove(color_group);
-        final List<ColorCount> color_counts1 = new ArrayList<ColorCount>(
-                color_group.color_counts.subList(0, median_index + 1));
-        final List<ColorCount> color_counts2 = new ArrayList<ColorCount>(
-                color_group.color_counts.subList(median_index + 1,
-                        color_group.color_counts.size()));
+        colorGroups.remove(colorGroup);
+        final List<ColorCount> colorCounts1 = new ArrayList<ColorCount>(
+                colorGroup.colorCounts.subList(0, medianIndex + 1));
+        final List<ColorCount> colorCounts2 = new ArrayList<ColorCount>(
+                colorGroup.colorCounts.subList(medianIndex + 1,
+                        colorGroup.colorCounts.size()));
 
         ColorGroup less, more;
-        less = new ColorGroup(new ArrayList<ColorCount>(color_counts1), ignoreAlpha);
-        color_groups.add(less);
-        more = new ColorGroup(new ArrayList<ColorCount>(color_counts2), ignoreAlpha);
-        color_groups.add(more);
+        less = new ColorGroup(new ArrayList<ColorCount>(colorCounts1), ignoreAlpha);
+        colorGroups.add(less);
+        more = new ColorGroup(new ArrayList<ColorCount>(colorCounts2), ignoreAlpha);
+        colorGroups.add(more);
 
-        final ColorCount median_value = color_group.color_counts
-                .get(median_index);
+        final ColorCount medianValue = colorGroup.colorCounts
+                .get(medianIndex);
         int limit;
         switch (mode) {
         case ALPHA:
-            limit = median_value.alpha;
+            limit = medianValue.alpha;
             break;
         case RED:
-            limit = median_value.red;
+            limit = medianValue.red;
             break;
         case GREEN:
-            limit = median_value.green;
+            limit = medianValue.green;
             break;
         case BLUE:
-            limit = median_value.blue;
+            limit = medianValue.blue;
             break;
         default:
             throw new Error("Bad mode.");
         }
-        color_group.cut = new ColorGroupCut(less, more, mode, limit);
+        colorGroup.cut = new ColorGroupCut(less, more, mode, limit);
     }
 }



Mime
View raw message