commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1342914 [2/5] - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: ./ color/ common/ common/bytesource/ common/itu_t4/ common/mylzw/
Date Sat, 26 May 2012 15:35:06 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java Sat May 26 15:35:04 2012
@@ -18,10 +18,8 @@ package org.apache.commons.imaging.color
 
 import org.apache.commons.imaging.util.Debug;
 
-public abstract class ColorConversions
-{
-    public static final ColorCieLab convertXYZtoCIELab(ColorXyz xyz)
-    {
+public abstract class ColorConversions {
+    public static final ColorCieLab convertXYZtoCIELab(ColorXyz xyz) {
         return convertXYZtoCIELab(xyz.X, xyz.Y, xyz.Z);
     }
 
@@ -29,12 +27,13 @@ public abstract class ColorConversions
     private static final double ref_Y = 100.000;
     private static final double ref_Z = 108.883;
 
-    public static final ColorCieLab convertXYZtoCIELab(double X, double Y, double Z)
-    {
+    public static final ColorCieLab convertXYZtoCIELab(double X, double Y,
+            double Z) {
 
-        double var_X = X / ref_X; //ref_X =  95.047  Observer= 2°, Illuminant= D65
-        double var_Y = Y / ref_Y; //ref_Y = 100.000
-        double var_Z = Z / ref_Z; //ref_Z = 108.883
+        double var_X = X / ref_X; // ref_X = 95.047 Observer= 2°, Illuminant=
+                                  // D65
+        double var_Y = Y / ref_Y; // ref_Y = 100.000
+        double var_Z = Z / ref_Z; // ref_Z = 108.883
 
         if (var_X > 0.008856)
             var_X = Math.pow(var_X, (1 / 3.0));
@@ -55,13 +54,11 @@ public abstract class ColorConversions
         return new ColorCieLab(L, a, b);
     }
 
-    public static final ColorXyz convertCIELabtoXYZ(ColorCieLab cielab)
-    {
+    public static final ColorXyz convertCIELabtoXYZ(ColorCieLab cielab) {
         return convertCIELabtoXYZ(cielab.L, cielab.a, cielab.b);
     }
 
-    public static final ColorXyz convertCIELabtoXYZ(double L, double a, double b)
-    {
+    public static final ColorXyz convertCIELabtoXYZ(double L, double a, double b) {
         double var_Y = (L + 16) / 116.0;
         double var_X = a / 500 + var_Y;
         double var_Z = var_Y - b / 200.0;
@@ -79,21 +76,20 @@ public abstract class ColorConversions
         else
             var_Z = (var_Z - 16 / 116.0) / 7.787;
 
-        double X = ref_X * var_X; //ref_X =  95.047  Observer= 2°, Illuminant= D65
-        double Y = ref_Y * var_Y; //ref_Y = 100.000
-        double Z = ref_Z * var_Z; //ref_Z = 108.883
+        double X = ref_X * var_X; // ref_X = 95.047 Observer= 2°, Illuminant=
+                                  // D65
+        double Y = ref_Y * var_Y; // ref_Y = 100.000
+        double Z = ref_Z * var_Z; // ref_Z = 108.883
 
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final ColorHunterLab convertXYZtoHunterLab(ColorXyz xyz)
-    {
+    public static final ColorHunterLab convertXYZtoHunterLab(ColorXyz xyz) {
         return convertXYZtoHunterLab(xyz.X, xyz.Y, xyz.Z);
     }
 
     public static final ColorHunterLab convertXYZtoHunterLab(double X,
-            double Y, double Z)
-    {
+            double Y, double Z) {
         double L = 10 * Math.sqrt(Y);
         double a = 17.5 * (((1.02 * X) - Y) / Math.sqrt(Y));
         double b = 7 * ((Y - (0.847 * Z)) / Math.sqrt(Y));
@@ -101,14 +97,12 @@ public abstract class ColorConversions
         return new ColorHunterLab(L, a, b);
     }
 
-    public static final ColorXyz convertHunterLabtoXYZ(ColorHunterLab cielab)
-    {
+    public static final ColorXyz convertHunterLabtoXYZ(ColorHunterLab cielab) {
         return convertHunterLabtoXYZ(cielab.L, cielab.a, cielab.b);
     }
 
     public static final ColorXyz convertHunterLabtoXYZ(double L, double a,
-            double b)
-    {
+            double b) {
         double var_Y = L / 10;
         double var_X = a / 17.5 * L / 10;
         double var_Z = b / 7 * L / 10;
@@ -120,17 +114,15 @@ public abstract class ColorConversions
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final int convertXYZtoRGB(ColorXyz xyz)
-    {
+    public static final int convertXYZtoRGB(ColorXyz xyz) {
         return convertXYZtoRGB(xyz.X, xyz.Y, xyz.Z);
     }
 
-    public static final int convertXYZtoRGB(double X, double Y, double Z)
-    {
-        //Observer = 2°, Illuminant = D65
-        double var_X = X / 100.0; //Where X = 0 ÷  95.047
-        double var_Y = Y / 100.0; //Where Y = 0 ÷ 100.000
-        double var_Z = Z / 100.0; //Where Z = 0 ÷ 108.883
+    public static final int convertXYZtoRGB(double X, double Y, double Z) {
+        // Observer = 2°, Illuminant = D65
+        double var_X = X / 100.0; // Where X = 0 ÷ 95.047
+        double var_Y = Y / 100.0; // Where Y = 0 ÷ 100.000
+        double var_Z = Z / 100.0; // Where Z = 0 ÷ 108.883
 
         double var_R = var_X * 3.2406 + var_Y * -1.5372 + var_Z * -0.4986;
         double var_G = var_X * -0.9689 + var_Y * 1.8758 + var_Z * 0.0415;
@@ -156,15 +148,14 @@ public abstract class ColorConversions
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final ColorXyz convertRGBtoXYZ(int rgb)
-    {
+    public static final ColorXyz convertRGBtoXYZ(int rgb) {
         int r = 0xff & (rgb >> 16);
         int g = 0xff & (rgb >> 8);
         int b = 0xff & (rgb >> 0);
 
-        double var_R = r / 255.0; //Where R = 0 ÷ 255
-        double var_G = g / 255.0; //Where G = 0 ÷ 255
-        double var_B = b / 255.0; //Where B = 0 ÷ 255
+        double var_R = r / 255.0; // Where R = 0 ÷ 255
+        double var_G = g / 255.0; // Where G = 0 ÷ 255
+        double var_B = b / 255.0; // Where B = 0 ÷ 255
 
         if (var_R > 0.04045)
             var_R = Math.pow((var_R + 0.055) / 1.055, 2.4);
@@ -183,7 +174,7 @@ public abstract class ColorConversions
         var_G = var_G * 100;
         var_B = var_B * 100;
 
-        //        Observer. = 2°, Illuminant = D65
+        // Observer. = 2°, Illuminant = D65
         double X = var_R * 0.4124 + var_G * 0.3576 + var_B * 0.1805;
         double Y = var_R * 0.2126 + var_G * 0.7152 + var_B * 0.0722;
         double Z = var_R * 0.0193 + var_G * 0.1192 + var_B * 0.9505;
@@ -191,14 +182,13 @@ public abstract class ColorConversions
         return new ColorXyz(X, Y, Z);
     }
 
-    public static final ColorCmy convertRGBtoCMY(int rgb)
-    {
+    public static final ColorCmy convertRGBtoCMY(int rgb) {
         int R = 0xff & (rgb >> 16);
         int G = 0xff & (rgb >> 8);
         int B = 0xff & (rgb >> 0);
 
-        //        RGB values = 0 ÷ 255
-        //        CMY values = 0 ÷ 1
+        // RGB values = 0 ÷ 255
+        // CMY values = 0 ÷ 1
 
         double C = 1 - (R / 255.0);
         double M = 1 - (G / 255.0);
@@ -207,16 +197,15 @@ public abstract class ColorConversions
         return new ColorCmy(C, M, Y);
     }
 
-    public static final int convertCMYtoRGB(ColorCmy cmy)
-    {
-        // From Ghostscript's gdevcdj.c: 
-        // *   Ghostscript:    R = (1.0 - C) * (1.0 - K)
-        // *   Adobe:          R = 1.0 - min(1.0, C + K)
+    public static final int convertCMYtoRGB(ColorCmy cmy) {
+        // From Ghostscript's gdevcdj.c:
+        // * Ghostscript: R = (1.0 - C) * (1.0 - K)
+        // * Adobe: R = 1.0 - min(1.0, C + K)
         // and similarly for G and B.
         // This is Ghostscript's formula with K = 0.
-        
-        //        CMY values = 0 ÷ 1
-        //        RGB values = 0 ÷ 255
+
+        // CMY values = 0 ÷ 1
+        // RGB values = 0 ÷ 255
 
         double R = (1 - cmy.C) * 255.0;
         double G = (1 - cmy.M) * 255.0;
@@ -225,9 +214,8 @@ public abstract class ColorConversions
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final ColorCmyk convertCMYtoCMYK(ColorCmy cmy)
-    {
-        //        Where CMYK and CMY values = 0 ÷ 1
+    public static final ColorCmyk convertCMYtoCMYK(ColorCmy cmy) {
+        // Where CMYK and CMY values = 0 ÷ 1
 
         double C = cmy.C;
         double M = cmy.M;
@@ -241,14 +229,11 @@ public abstract class ColorConversions
             var_K = M;
         if (Y < var_K)
             var_K = Y;
-        if (var_K == 1)
-        { //Black
+        if (var_K == 1) { // Black
             C = 0;
             M = 0;
             Y = 0;
-        }
-        else
-        {
+        } else {
             C = (C - var_K) / (1 - var_K);
             M = (M - var_K) / (1 - var_K);
             Y = (Y - var_K) / (1 - var_K);
@@ -256,15 +241,13 @@ public abstract class ColorConversions
         return new ColorCmyk(C, M, Y, var_K);
     }
 
-    public static final ColorCmy convertCMYKtoCMY(ColorCmyk cmyk)
-    {
+    public static final ColorCmy convertCMYKtoCMY(ColorCmyk cmyk) {
         return convertCMYKtoCMY(cmyk.C, cmyk.M, cmyk.Y, cmyk.K);
     }
 
     public static final ColorCmy convertCMYKtoCMY(double C, double M, double Y,
-            double K)
-    {
-        //    Where CMYK and CMY values = 0 ÷ 1
+            double K) {
+        // Where CMYK and CMY values = 0 ÷ 1
 
         C = (C * (1 - K) + K);
         M = (M * (1 - K) + K);
@@ -274,7 +257,7 @@ public abstract class ColorConversions
     }
 
     public static final int convertCMYKtoRGB(int c, int m, int y, int k)
-    //    throws ImageReadException, IOException
+    // throws ImageReadException, IOException
     {
         double C = c / 255.0;
         double M = m / 255.0;
@@ -284,41 +267,41 @@ public abstract class ColorConversions
         return convertCMYtoRGB(convertCMYKtoCMY(C, M, Y, K));
     }
 
-    public static final ColorHsl convertRGBtoHSL(int rgb)
-    {
+    public static final ColorHsl convertRGBtoHSL(int rgb) {
 
         int R = 0xff & (rgb >> 16);
         int G = 0xff & (rgb >> 8);
         int B = 0xff & (rgb >> 0);
 
-        double var_R = (R / 255.0); //Where RGB values = 0 ÷ 255
+        double var_R = (R / 255.0); // Where RGB values = 0 ÷ 255
         double var_G = (G / 255.0);
         double var_B = (B / 255.0);
 
-        double var_Min = Math.min(var_R, Math.min(var_G, var_B)); //Min. value of RGB
-        double var_Max = Math.max(var_R, Math.max(var_G, var_B)); //Max. value of RGB
-        double del_Max = var_Max - var_Min; //Delta RGB value
+        double var_Min = Math.min(var_R, Math.min(var_G, var_B)); // Min. value
+                                                                  // of RGB
+        double var_Max = Math.max(var_R, Math.max(var_G, var_B)); // Max. value
+                                                                  // of RGB
+        double del_Max = var_Max - var_Min; // Delta RGB value
 
         double L = (var_Max + var_Min) / 2.0;
 
         double H, S;
-        //        Debug.debug("del_Max", del_Max);
-        if (del_Max == 0) //This is a gray, no chroma...
+        // Debug.debug("del_Max", del_Max);
+        if (del_Max == 0) // This is a gray, no chroma...
         {
-            H = 0; //HSL results = 0 ÷ 1
+            H = 0; // HSL results = 0 ÷ 1
             S = 0;
-        }
-        else
-        //Chromatic data...
+        } else
+        // Chromatic data...
         {
-            //            Debug.debug("L", L);
+            // Debug.debug("L", L);
 
             if (L < 0.5)
                 S = del_Max / (var_Max + var_Min);
             else
                 S = del_Max / (2 - var_Max - var_Min);
 
-            //            Debug.debug("S", S);
+            // Debug.debug("S", S);
 
             double del_R = (((var_Max - var_R) / 6) + (del_Max / 2)) / del_Max;
             double del_G = (((var_Max - var_G) / 6) + (del_Max / 2)) / del_Max;
@@ -330,42 +313,37 @@ public abstract class ColorConversions
                 H = (1 / 3.0) + del_R - del_B;
             else if (var_B == var_Max)
                 H = (2 / 3.0) + del_G - del_R;
-            else
-            {
+            else {
                 Debug.debug("uh oh");
                 H = 0; // cmc
             }
 
-            //            Debug.debug("H1", H);
+            // Debug.debug("H1", H);
 
             if (H < 0)
                 H += 1;
             if (H > 1)
                 H -= 1;
 
-            //            Debug.debug("H2", H);
+            // Debug.debug("H2", H);
         }
 
         return new ColorHsl(H, S, L);
     }
 
-    public static int convertHSLtoRGB(ColorHsl hsl)
-    {
+    public static int convertHSLtoRGB(ColorHsl hsl) {
         return convertHSLtoRGB(hsl.H, hsl.S, hsl.L);
     }
 
-    public static int convertHSLtoRGB(double H, double S, double L)
-    {
+    public static int convertHSLtoRGB(double H, double S, double L) {
         double R, G, B;
 
-        if (S == 0) //HSL values = 0 ÷ 1
+        if (S == 0) // HSL values = 0 ÷ 1
         {
-            R = L * 255; //RGB results = 0 ÷ 255
+            R = L * 255; // RGB results = 0 ÷ 255
             G = L * 255;
             B = L * 255;
-        }
-        else
-        {
+        } else {
             double var_2;
 
             if (L < 0.5)
@@ -383,7 +361,8 @@ public abstract class ColorConversions
         return convertRGBtoRGB(R, G, B);
     }
 
-    private static double convertHuetoRGB(double v1, double v2, double vH) //Function Hue_2_RGB
+    private static double convertHuetoRGB(double v1, double v2, double vH) // Function
+                                                                           // Hue_2_RGB
     {
         if (vH < 0)
             vH += 1;
@@ -398,30 +377,30 @@ public abstract class ColorConversions
         return (v1);
     }
 
-    public static final ColorHsv convertRGBtoHSV(int rgb)
-    {
+    public static final ColorHsv convertRGBtoHSV(int rgb) {
         int R = 0xff & (rgb >> 16);
         int G = 0xff & (rgb >> 8);
         int B = 0xff & (rgb >> 0);
 
-        double var_R = (R / 255.0); //RGB values = 0 ÷ 255
+        double var_R = (R / 255.0); // RGB values = 0 ÷ 255
         double var_G = (G / 255.0);
         double var_B = (B / 255.0);
 
-        double var_Min = Math.min(var_R, Math.min(var_G, var_B)); //Min. value of RGB
-        double var_Max = Math.max(var_R, Math.max(var_G, var_B)); //Max. value of RGB
-        double del_Max = var_Max - var_Min; //Delta RGB value
+        double var_Min = Math.min(var_R, Math.min(var_G, var_B)); // Min. value
+                                                                  // of RGB
+        double var_Max = Math.max(var_R, Math.max(var_G, var_B)); // Max. value
+                                                                  // of RGB
+        double del_Max = var_Max - var_Min; // Delta RGB value
 
         double V = var_Max;
 
         double H, S;
-        if (del_Max == 0) //This is a gray, no chroma...
+        if (del_Max == 0) // This is a gray, no chroma...
         {
-            H = 0; //HSV results = 0 ÷ 1
+            H = 0; // HSV results = 0 ÷ 1
             S = 0;
-        }
-        else
-        //Chromatic data...
+        } else
+        // Chromatic data...
         {
             S = del_Max / var_Max;
 
@@ -435,8 +414,7 @@ public abstract class ColorConversions
                 H = (1 / 3.0) + del_R - del_B;
             else if (var_B == var_Max)
                 H = (2 / 3.0) + del_G - del_R;
-            else
-            {
+            else {
                 Debug.debug("uh oh");
                 H = 0; // cmc;
             }
@@ -450,71 +428,56 @@ public abstract class ColorConversions
         return new ColorHsv(H, S, V);
     }
 
-    public static int convertHSVtoRGB(ColorHsv HSV)
-    {
+    public static int convertHSVtoRGB(ColorHsv HSV) {
         return convertHSVtoRGB(HSV.H, HSV.S, HSV.V);
     }
 
-    public static int convertHSVtoRGB(double H, double S, double V)
-    {
+    public static int convertHSVtoRGB(double H, double S, double V) {
         double R, G, B;
 
-        if (S == 0) //HSV values = 0 ÷ 1
+        if (S == 0) // HSV values = 0 ÷ 1
         {
             R = V * 255;
             G = V * 255;
             B = V * 255;
-        }
-        else
-        {
+        } else {
             double var_h = H * 6;
             if (var_h == 6)
-                var_h = 0; //H must be < 1
-            double var_i = Math.floor(var_h); //Or ... var_i = floor( var_h )
+                var_h = 0; // H must be < 1
+            double var_i = Math.floor(var_h); // Or ... var_i = floor( var_h )
             double var_1 = V * (1 - S);
             double var_2 = V * (1 - S * (var_h - var_i));
             double var_3 = V * (1 - S * (1 - (var_h - var_i)));
 
             double var_r, var_g, var_b;
 
-            if (var_i == 0)
-            {
+            if (var_i == 0) {
                 var_r = V;
                 var_g = var_3;
                 var_b = var_1;
-            }
-            else if (var_i == 1)
-            {
+            } else if (var_i == 1) {
                 var_r = var_2;
                 var_g = V;
                 var_b = var_1;
-            }
-            else if (var_i == 2)
-            {
+            } else if (var_i == 2) {
                 var_r = var_1;
                 var_g = V;
                 var_b = var_3;
-            }
-            else if (var_i == 3)
-            {
+            } else if (var_i == 3) {
                 var_r = var_1;
                 var_g = var_2;
                 var_b = V;
-            }
-            else if (var_i == 4)
-            {
+            } else if (var_i == 4) {
                 var_r = var_3;
                 var_g = var_1;
                 var_b = V;
-            }
-            else
-            {
+            } else {
                 var_r = V;
                 var_g = var_1;
                 var_b = var_2;
             }
 
-            R = var_r * 255; //RGB results = 0 ÷ 255
+            R = var_r * 255; // RGB results = 0 ÷ 255
             G = var_g * 255;
             B = var_b * 255;
         }
@@ -522,8 +485,9 @@ public abstract class ColorConversions
         return convertRGBtoRGB(R, G, B);
     }
 
-    public static final int convertCMYKtoRGB_Adobe(int sc, int sm, int sy, int sk)
-    //    throws ImageReadException, IOException
+    public static final int convertCMYKtoRGB_Adobe(int sc, int sm, int sy,
+            int sk)
+    // throws ImageReadException, IOException
     {
         int red = 255 - (sc + sk);
         int green = 255 - (sm + sk);
@@ -532,18 +496,15 @@ public abstract class ColorConversions
         return convertRGBtoRGB(red, green, blue);
     }
 
-    private static double cube(double f)
-    {
+    private static double cube(double f) {
         return f * f * f;
     }
 
-    private static double square(double f)
-    {
+    private static double square(double f) {
         return f * f;
     }
 
-    public static final int convertCIELabtoARGBTest(int cieL, int cieA, int cieB)
-    {
+    public static final int convertCIELabtoARGBTest(int cieL, int cieA, int cieB) {
         double X, Y, Z;
 
         {
@@ -571,21 +532,21 @@ public abstract class ColorConversions
             else
                 var_Z = (var_Z - 16 / 116.0) / 7.787;
 
-            //            double ref_X = 95.047;
-            //            double ref_Y = 100.000;
-            //            double ref_Z = 108.883;
-
-            X = ref_X * var_X; //ref_X =  95.047  Observer= 2°, Illuminant= D65
-            Y = ref_Y * var_Y; //ref_Y = 100.000
-            Z = ref_Z * var_Z; //ref_Z = 108.883
+            // double ref_X = 95.047;
+            // double ref_Y = 100.000;
+            // double ref_Z = 108.883;
+
+            X = ref_X * var_X; // ref_X = 95.047 Observer= 2°, Illuminant= D65
+            Y = ref_Y * var_Y; // ref_Y = 100.000
+            Z = ref_Z * var_Z; // ref_Z = 108.883
 
         }
 
         double R, G, B;
         {
-            double var_X = X / 100; //X = From 0 to ref_X
-            double var_Y = Y / 100; //Y = From 0 to ref_Y
-            double var_Z = Z / 100; //Z = From 0 to ref_Y
+            double var_X = X / 100; // X = From 0 to ref_X
+            double var_Y = Y / 100; // Y = From 0 to ref_Y
+            double var_Z = Z / 100; // Z = From 0 to ref_Y
 
             double var_R = var_X * 3.2406 + var_Y * -1.5372 + var_Z * -0.4986;
             double var_G = var_X * -0.9689 + var_Y * 1.8758 + var_Z * 0.0415;
@@ -613,8 +574,7 @@ public abstract class ColorConversions
         return convertRGBtoRGB(R, G, B);
     }
 
-    private static final int convertRGBtoRGB(double R, double G, double B)
-    {
+    private static final int convertRGBtoRGB(double R, double G, double B) {
         int red = (int) Math.round(R);
         int green = (int) Math.round(G);
         int blue = (int) Math.round(B);
@@ -629,8 +589,7 @@ public abstract class ColorConversions
         return rgb;
     }
 
-    private static final int convertRGBtoRGB(int red, int green, int blue)
-    {
+    private static final int convertRGBtoRGB(int red, int green, int blue) {
         red = Math.min(255, Math.max(0, red));
         green = Math.min(255, Math.max(0, green));
         blue = Math.min(255, Math.max(0, blue));
@@ -641,87 +600,79 @@ public abstract class ColorConversions
         return rgb;
     }
 
-    public static ColorCieLch convertCIELabtoCIELCH(ColorCieLab cielab)
-    {
+    public static ColorCieLch convertCIELabtoCIELCH(ColorCieLab cielab) {
         return convertCIELabtoCIELCH(cielab.L, cielab.a, cielab.b);
     }
 
-    public static ColorCieLch convertCIELabtoCIELCH(double L, double a, double b)
-    {
-        double var_H = Math.atan2(b, a); //Quadrant by signs
+    public static ColorCieLch convertCIELabtoCIELCH(double L, double a, double b) {
+        double var_H = Math.atan2(b, a); // Quadrant by signs
 
         if (var_H > 0)
             var_H = (var_H / Math.PI) * 180.0;
         else
             var_H = 360 - radian_2_degree(Math.abs(var_H));
 
-        //        L = L;
+        // L = L;
         double C = Math.sqrt(square(a) + square(b));
         double H = var_H;
 
         return new ColorCieLch(L, C, H);
     }
 
-    public static ColorCieLab convertCIELCHtoCIELab(ColorCieLch cielch)
-    {
+    public static ColorCieLab convertCIELCHtoCIELab(ColorCieLch cielch) {
         return convertCIELCHtoCIELab(cielch.L, cielch.C, cielch.H);
     }
 
-    public static ColorCieLab convertCIELCHtoCIELab(double L, double C, double H)
-    {
-        //        Where CIE-H° = 0 ÷ 360°
+    public static ColorCieLab convertCIELCHtoCIELab(double L, double C, double H) {
+        // Where CIE-H° = 0 ÷ 360°
 
-        //        CIE-L* = CIE-L;
+        // CIE-L* = CIE-L;
         double a = Math.cos(degree_2_radian(H)) * C;
         double b = Math.sin(degree_2_radian(H)) * C;
 
         return new ColorCieLab(L, a, b);
     }
 
-    public static double degree_2_radian(double degree)
-    {
+    public static double degree_2_radian(double degree) {
         return degree * Math.PI / 180.0;
     }
 
-    public static double radian_2_degree(double radian)
-    {
+    public static double radian_2_degree(double radian) {
         return radian * 180.0 / Math.PI;
     }
 
-    public static ColorCieLuv convertXYZtoCIELuv(ColorXyz xyz)
-    {
+    public static ColorCieLuv convertXYZtoCIELuv(ColorXyz xyz) {
         return convertXYZtoCIELuv(xyz.X, xyz.Y, xyz.Z);
     }
 
-    public static ColorCieLuv convertXYZtoCIELuv(double X, double Y, double Z)
-    {
+    public static ColorCieLuv convertXYZtoCIELuv(double X, double Y, double Z) {
         // problems here with div by zero
 
         double var_U = (4 * X) / (X + (15 * Y) + (3 * Z));
         double var_V = (9 * Y) / (X + (15 * Y) + (3 * Z));
 
-        //        Debug.debug("var_U", var_U);
-        //        Debug.debug("var_V", var_V);
+        // Debug.debug("var_U", var_U);
+        // Debug.debug("var_V", var_V);
 
         double var_Y = Y / 100.0;
-        //        Debug.debug("var_Y", var_Y);
+        // Debug.debug("var_Y", var_Y);
 
         if (var_Y > 0.008856)
             var_Y = Math.pow(var_Y, (1 / 3.0));
         else
             var_Y = (7.787 * var_Y) + (16 / 116.0);
 
-        double ref_X = 95.047; //Observer= 2°, Illuminant= D65
+        double ref_X = 95.047; // Observer= 2°, Illuminant= D65
         double ref_Y = 100.000;
         double ref_Z = 108.883;
 
-        //        Debug.debug("var_Y", var_Y);
+        // Debug.debug("var_Y", var_Y);
 
         double ref_U = (4 * ref_X) / (ref_X + (15 * ref_Y) + (3 * ref_Z));
         double ref_V = (9 * ref_Y) / (ref_X + (15 * ref_Y) + (3 * ref_Z));
 
-        //        Debug.debug("ref_U", ref_U);
-        //        Debug.debug("ref_V", ref_V);
+        // Debug.debug("ref_U", ref_U);
+        // Debug.debug("ref_V", ref_V);
 
         double L = (116 * var_Y) - 16;
         double u = 13 * L * (var_U - ref_U);
@@ -730,13 +681,11 @@ public abstract class ColorConversions
         return new ColorCieLuv(L, u, v);
     }
 
-    public static ColorXyz convertCIELuvtoXYZ(ColorCieLuv cielch)
-    {
+    public static ColorXyz convertCIELuvtoXYZ(ColorCieLuv cielch) {
         return convertCIELuvtoXYZ(cielch.L, cielch.u, cielch.v);
     }
 
-    public static ColorXyz convertCIELuvtoXYZ(double L, double u, double v)
-    {
+    public static ColorXyz convertCIELuvtoXYZ(double L, double u, double v) {
         // problems here with div by zero
 
         double var_Y = (L + 16) / 116;
@@ -745,7 +694,7 @@ public abstract class ColorConversions
         else
             var_Y = (var_Y - 16 / 116) / 7.787;
 
-        double ref_X = 95.047; //Observer= 2°, Illuminant= D65
+        double ref_X = 95.047; // Observer= 2°, Illuminant= D65
         double ref_Y = 100.000;
         double ref_Z = 108.883;
 
@@ -760,4 +709,4 @@ public abstract class ColorConversions
 
         return new ColorXyz(X, Y, Z);
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsl.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsl.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsl.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
  */
 package org.apache.commons.imaging.color;
 
-public final class ColorHsl
-{
+public final class ColorHsl {
     public final double H, S, L;
 
-    public ColorHsl(double h, double s, double v)
-    {
+    public ColorHsl(double h, double s, double v) {
         H = h;
         S = s;
         L = v;
     }
 
     @Override
-    public final String toString()
-    {
+    public final String toString() {
         return "{H: " + H + ", S: " + S + ", L: " + L + "}";
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsv.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsv.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsv.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
  */
 package org.apache.commons.imaging.color;
 
-public final class ColorHsv
-{
+public final class ColorHsv {
     public final double H, S, V;
 
-    public ColorHsv(double h, double s, double v)
-    {
+    public ColorHsv(double h, double s, double v) {
         H = h;
         S = s;
         V = v;
     }
 
     @Override
-    public final String toString()
-    {
+    public final String toString() {
         return "{H: " + H + ", S: " + S + ", V: " + V + "}";
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
  */
 package org.apache.commons.imaging.color;
 
-public final class ColorHunterLab
-{
+public final class ColorHunterLab {
     public final double L, a, b;
 
-    public ColorHunterLab(double l, double a, double b)
-    {
+    public ColorHunterLab(double l, double a, double b) {
         L = l;
         this.a = a;
         this.b = b;
     }
 
     @Override
-    public final String toString()
-    {
+    public final String toString() {
         return "{L: " + L + ", a: " + a + ", b: " + b + "}";
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorXyz.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorXyz.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorXyz.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
  */
 package org.apache.commons.imaging.color;
 
-public final class ColorXyz
-{
+public final class ColorXyz {
     public final double X, Y, Z;
 
-    public ColorXyz(double x, double y, double z)
-    {
+    public ColorXyz(double x, double y, double z) {
         X = x;
         Y = y;
         Z = z;
     }
 
     @Override
-    public final String toString()
-    {
+    public final String toString() {
         return "{X: " + X + ", Y: " + Y + ", Z: " + Z + "}";
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java Sat May 26 15:35:04 2012
@@ -24,17 +24,14 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageReadException;
 
-public class BasicCParser
-{
+public class BasicCParser {
     private PushbackInputStream is;
 
-    public BasicCParser(ByteArrayInputStream is)
-    {
+    public BasicCParser(ByteArrayInputStream is) {
         this.is = new PushbackInputStream(is);
     }
 
-    public String nextToken() throws IOException, ImageReadException
-    {
+    public String nextToken() throws IOException, ImageReadException {
         // I don't know how complete the C parsing in an XPM file
         // is meant to be, this is just the very basics...
 
@@ -42,65 +39,49 @@ public class BasicCParser
         boolean inIdentifier = false;
         boolean hadBackSlash = false;
         StringBuilder token = new StringBuilder();
-        for (int c = is.read(); c != -1; c = is.read())
-        {
-            if (inString)
-            {
-                if (c == '\\')
-                {
+        for (int c = is.read(); c != -1; c = is.read()) {
+            if (inString) {
+                if (c == '\\') {
                     token.append('\\');
                     hadBackSlash = !hadBackSlash;
-                }
-                else if (c == '"')
-                {
+                } else if (c == '"') {
                     token.append('"');
                     if (!hadBackSlash)
                         return token.toString();
                     hadBackSlash = false;
-                }
-                else if (c == '\r' || c == '\n')
-                    throw new ImageReadException("Unterminated string in XPM file");
-                else
-                {
-                    token.append((char)c);
+                } else if (c == '\r' || c == '\n')
+                    throw new ImageReadException(
+                            "Unterminated string in XPM file");
+                else {
+                    token.append((char) c);
                     hadBackSlash = false;
                 }
-            }
-            else if (inIdentifier)
-            {
+            } else if (inIdentifier) {
                 if (Character.isLetterOrDigit(c) || c == '_')
-                    token.append((char)c);
-                else
-                {
+                    token.append((char) c);
+                else {
                     is.unread(c);
                     return token.toString();
                 }
-            }
-            else
-            {
-                if (c == '"')
-                {
+            } else {
+                if (c == '"') {
                     token.append('"');
                     inString = true;
-                }
-                else if (Character.isLetterOrDigit(c) || c == '_')
-                {
-                    token.append((char)c);
+                } else if (Character.isLetterOrDigit(c) || c == '_') {
+                    token.append((char) c);
                     inIdentifier = true;
-                }
-                else if (c == '{' || c == '}' ||
-                        c == '[' || c == ']' ||
-                        c == '*' || c == ';' ||
-                        c == '=' || c == ',')
-                {
-                    token.append((char)c);
+                } else if (c == '{' || c == '}' || c == '[' || c == ']'
+                        || c == '*' || c == ';' || c == '=' || c == ',') {
+                    token.append((char) c);
                     return token.toString();
-                }
-                else if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
-                { /* do nothing */ }
-                else
-                    throw new ImageReadException("Unhandled/invalid character '" +
-                            ((char)c) + "' found in XPM file");
+                } else if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { /*
+                                                                               * do
+                                                                               * nothing
+                                                                               */
+                } else
+                    throw new ImageReadException(
+                            "Unhandled/invalid character '" + ((char) c)
+                                    + "' found in XPM file");
             }
         }
 
@@ -113,8 +94,7 @@ public class BasicCParser
 
     public static ByteArrayOutputStream preprocess(InputStream is,
             StringBuilder firstComment, Map<String, String> defines)
-            throws IOException, ImageReadException
-    {
+            throws IOException, ImageReadException {
         boolean inString = false;
         boolean inComment = false;
         boolean inDirective = false;
@@ -124,118 +104,85 @@ public class BasicCParser
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         boolean seenFirstComment = (firstComment == null);
         StringBuilder directiveBuffer = new StringBuilder();
-        for (int c = is.read(); c != -1; c = is.read())
-        {
-            if (inComment)
-            {
-                if (c == '*')
-                {
+        for (int c = is.read(); c != -1; c = is.read()) {
+            if (inComment) {
+                if (c == '*') {
                     if (hadStar && !seenFirstComment)
                         firstComment.append('*');
                     hadStar = true;
-                }
-                else if(c == '/')
-                {
-                    if (hadStar)
-                    {
+                } else if (c == '/') {
+                    if (hadStar) {
                         hadStar = false;
                         inComment = false;
                         seenFirstComment = true;
-                    }
-                    else
+                    } else
                         out.write(c);
-                }
-                else
-                {
+                } else {
                     if (hadStar && !seenFirstComment)
                         firstComment.append('*');
                     hadStar = false;
                     if (!seenFirstComment)
-                        firstComment.append((char)c);
+                        firstComment.append((char) c);
                 }
-            }
-            else if (inString)
-            {
-                if (c == '\\')
-                {
+            } else if (inString) {
+                if (c == '\\') {
                     if (hadBackSlash)
                         out.write('\\');
                     hadBackSlash = true;
-                }
-                else if (c == '"')
-                {
-                    if (hadBackSlash)
-                    {
+                } else if (c == '"') {
+                    if (hadBackSlash) {
                         out.write('\\');
                         hadBackSlash = false;
-                    }
-                    else
+                    } else
                         inString = false;
                     out.write('"');
-                }
-                else if (c == '\r' || c == '\n')
+                } else if (c == '\r' || c == '\n')
                     throw new ImageReadException("Unterminated string in file");
-                else
-                {
-                    if (hadBackSlash)
-                    {
+                else {
+                    if (hadBackSlash) {
                         out.write('\\');
                         hadBackSlash = false;
                     }
                     out.write(c);
                 }
-            }
-            else if (inDirective)
-            {
-                if (c == '\r' || c == '\n')
-                {
+            } else if (inDirective) {
+                if (c == '\r' || c == '\n') {
                     inDirective = false;
                     String[] tokens = tokenizeRow(directiveBuffer.toString());
                     if (tokens.length < 2 || tokens.length > 3)
-                        throw new ImageReadException("Bad preprocessor directive");
+                        throw new ImageReadException(
+                                "Bad preprocessor directive");
                     if (!tokens[0].equals("define"))
-                        throw new ImageReadException("Invalid/unsupported " +
-                                "preprocessor directive '" + tokens[0] + "'");
-                    defines.put(tokens[1], (tokens.length == 3) ? tokens[2] : null);
+                        throw new ImageReadException("Invalid/unsupported "
+                                + "preprocessor directive '" + tokens[0] + "'");
+                    defines.put(tokens[1], (tokens.length == 3) ? tokens[2]
+                            : null);
                     directiveBuffer.setLength(0);
-                }
-                else
-                    directiveBuffer.append((char)c);
-            }
-            else
-            {
-                if (c == '/')
-                {
+                } else
+                    directiveBuffer.append((char) c);
+            } else {
+                if (c == '/') {
                     if (hadSlash)
                         out.write('/');
                     hadSlash = true;
-                }
-                else if (c == '*')
-                {
-                    if (hadSlash)
-                    {
+                } else if (c == '*') {
+                    if (hadSlash) {
                         inComment = true;
                         hadSlash = false;
-                    }
-                    else
+                    } else
                         out.write(c);
-                }
-                else if (c == '"')
-                {
+                } else if (c == '"') {
                     if (hadSlash)
                         out.write('/');
                     hadSlash = false;
                     out.write(c);
                     inString = true;
-                }
-                else if (c == '#')
-                {
+                } else if (c == '#') {
                     if (defines == null)
-                        throw new ImageReadException("Unexpected preprocessor directive");
+                        throw new ImageReadException(
+                                "Unexpected preprocessor directive");
                     inDirective = true;
-                }
-                else
-                {
+                } else {
                     if (hadSlash)
                         out.write('/');
                     hadSlash = false;
@@ -251,25 +198,24 @@ public class BasicCParser
         if (hadStar)
             out.write('*');
         if (inString)
-            throw new ImageReadException("Unterminated string at the end of file");
+            throw new ImageReadException(
+                    "Unterminated string at the end of file");
         if (inComment)
-            throw new ImageReadException("Unterminated comment at the end of file");
+            throw new ImageReadException(
+                    "Unterminated comment at the end of file");
         return out;
     }
 
-    public static String[] tokenizeRow(String row)
-    {
+    public static String[] tokenizeRow(String row) {
         String[] tokens = row.split("[ \t]");
         int numLiveTokens = 0;
-        for (int i = 0; i < tokens.length; i++)
-        {
+        for (int i = 0; i < tokens.length; i++) {
             if (tokens[i] != null && tokens[i].length() > 0)
                 ++numLiveTokens;
         }
         String[] liveTokens = new String[numLiveTokens];
         int next = 0;
-        for (int i = 0; i < tokens.length; i++)
-        {
+        for (int i = 0; i < tokens.length; i++) {
             if (tokens[i] != null && tokens[i].length() > 0)
                 liveTokens[next++] = tokens[i];
         }
@@ -277,97 +223,87 @@ public class BasicCParser
     }
 
     public static void unescapeString(StringBuilder stringBuilder, String string)
-            throws ImageReadException
-    {
+            throws ImageReadException {
         if (string.length() < 2)
-            throw new ImageReadException("Parsing XPM file failed, " +
-                    "string is too short");
-        if (string.charAt(0) != '"' || string.charAt(string.length() - 1) != '"')
-            throw new ImageReadException("Parsing XPM file failed, " +
-                    "string not surrounded by '\"'");
+            throw new ImageReadException("Parsing XPM file failed, "
+                    + "string is too short");
+        if (string.charAt(0) != '"'
+                || string.charAt(string.length() - 1) != '"')
+            throw new ImageReadException("Parsing XPM file failed, "
+                    + "string not surrounded by '\"'");
         boolean hadBackSlash = false;
-        for (int i = 1; i < (string.length() - 1); i++)
-        {
+        for (int i = 1; i < (string.length() - 1); i++) {
             char c = string.charAt(i);
-            if (hadBackSlash)
-            {
+            if (hadBackSlash) {
                 if (c == '\\')
                     stringBuilder.append('\\');
                 else if (c == '"')
                     stringBuilder.append('"');
                 else if (c == '\'')
                     stringBuilder.append('\'');
-                else if (c == 'x')
-                {
+                else if (c == 'x') {
                     if (i + 2 >= string.length())
-                        throw new ImageReadException("Parsing XPM file failed, " +
-                                "hex constant in string too short");
+                        throw new ImageReadException(
+                                "Parsing XPM file failed, "
+                                        + "hex constant in string too short");
                     char hex1 = string.charAt(i + 1);
                     char hex2 = string.charAt(i + 2);
                     i += 2;
                     int constant;
-                    try
-                    {
-                        constant =  Integer.parseInt("" + hex1 + hex2, 16);
-                    }
-                    catch (NumberFormatException nfe)
-                    {
-                        throw new ImageReadException("Parsing XPM file failed, " +
-                                "hex constant invalid", nfe);
+                    try {
+                        constant = Integer.parseInt("" + hex1 + hex2, 16);
+                    } catch (NumberFormatException nfe) {
+                        throw new ImageReadException(
+                                "Parsing XPM file failed, "
+                                        + "hex constant invalid", nfe);
                     }
-                    stringBuilder.append((char)constant);
-                }
-                else if (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' ||
-                        c == '5' || c == '6' || c == '7')
-                {
+                    stringBuilder.append((char) constant);
+                } else if (c == '0' || c == '1' || c == '2' || c == '3'
+                        || c == '4' || c == '5' || c == '6' || c == '7') {
                     int length = 1;
-                    if (i+1 < string.length() && '0' <= string.charAt(i+1) &&
-                            string.charAt(i+1) <= '7')
+                    if (i + 1 < string.length() && '0' <= string.charAt(i + 1)
+                            && string.charAt(i + 1) <= '7')
                         ++length;
-                    if (i+2 < string.length() && '0' <= string.charAt(i+2) &&
-                            string.charAt(i+2) <= '7')
+                    if (i + 2 < string.length() && '0' <= string.charAt(i + 2)
+                            && string.charAt(i + 2) <= '7')
                         ++length;
                     int constant = 0;
-                    for (int j = 0; j < length; j++)
-                    {
+                    for (int j = 0; j < length; j++) {
                         constant *= 8;
                         constant += (string.charAt(i + j) - '0');
                     }
                     i += length - 1;
-                    stringBuilder.append((char)constant);
-                }
-                else if (c == 'a')
-                    stringBuilder.append((char)0x07);
+                    stringBuilder.append((char) constant);
+                } else if (c == 'a')
+                    stringBuilder.append((char) 0x07);
                 else if (c == 'b')
-                    stringBuilder.append((char)0x08);
+                    stringBuilder.append((char) 0x08);
                 else if (c == 'f')
-                    stringBuilder.append((char)0x0c);
+                    stringBuilder.append((char) 0x0c);
                 else if (c == 'n')
-                    stringBuilder.append((char)0x0a);
+                    stringBuilder.append((char) 0x0a);
                 else if (c == 'r')
-                    stringBuilder.append((char)0x0d);
+                    stringBuilder.append((char) 0x0d);
                 else if (c == 't')
-                    stringBuilder.append((char)0x09);
+                    stringBuilder.append((char) 0x09);
                 else if (c == 'v')
-                    stringBuilder.append((char)0x0b);
+                    stringBuilder.append((char) 0x0b);
                 else
-                    throw new ImageReadException("Parsing XPM file failed, " +
-                            "invalid escape sequence");
+                    throw new ImageReadException("Parsing XPM file failed, "
+                            + "invalid escape sequence");
                 hadBackSlash = false;
-            }
-            else
-            {
+            } else {
                 if (c == '\\')
                     hadBackSlash = true;
                 else if (c == '"')
-                    throw new ImageReadException("Parsing XPM file failed, " +
-                            "extra '\"' found in string");
+                    throw new ImageReadException("Parsing XPM file failed, "
+                            + "extra '\"' found in string");
                 else
                     stringBuilder.append(c);
             }
         }
         if (hadBackSlash)
-            throw new ImageReadException("Parsing XPM file failed, " +
-                    "unterminated escape sequence found in string");
+            throw new ImageReadException("Parsing XPM file failed, "
+                    + "unterminated escape sequence found in string");
     }
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstant.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstant.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstant.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstant.java Sat May 26 15:35:04 2012
@@ -22,16 +22,16 @@ import java.util.Arrays;
 
 public class BinaryConstant implements Cloneable {
     private final byte[] value;
-    
+
     public BinaryConstant(byte[] value) {
         this.value = value.clone();
     }
-    
+
     @Override
     public BinaryConstant clone() throws CloneNotSupportedException {
         return (BinaryConstant) super.clone();
     }
-    
+
     @Override
     public boolean equals(Object obj) {
         if (obj == null) {
@@ -40,14 +40,14 @@ public class BinaryConstant implements C
         if (!(obj instanceof BinaryConstant)) {
             return false;
         }
-        BinaryConstant other = (BinaryConstant)obj;
+        BinaryConstant other = (BinaryConstant) obj;
         return equals(other.value);
     }
-    
+
     public boolean equals(byte[] bytes) {
         return Arrays.equals(value, bytes);
     }
-    
+
     public boolean equals(byte[] bytes, int offset, int length) {
         if (value.length != length) {
             return false;
@@ -59,24 +59,24 @@ public class BinaryConstant implements C
         }
         return true;
     }
-    
+
     @Override
     public int hashCode() {
         return Arrays.hashCode(value);
     }
-    
+
     public byte get(int i) {
         return value[i];
     }
-    
+
     public int size() {
         return value.length;
     }
-    
+
     public byte[] toByteArray() {
         return value.clone();
     }
-    
+
     public void writeTo(OutputStream os) throws IOException {
         for (int i = 0; i < value.length; i++) {
             os.write(value[i]);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstants.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstants.java Sat May 26 15:35:04 2012
@@ -16,8 +16,7 @@
  */
 package org.apache.commons.imaging.common;
 
-public interface BinaryConstants
-{
+public interface BinaryConstants {
     public static final int BYTE_ORDER_INTEL = 'I';
     public static final int BYTE_ORDER_LEAST_SIGNIFICANT_BYTE = BYTE_ORDER_INTEL;
     public static final int BYTE_ORDER_LSB = BYTE_ORDER_INTEL;
@@ -29,4 +28,4 @@ public interface BinaryConstants
     public static final int BYTE_ORDER_NETWORK = BYTE_ORDER_MOTOROLA;
     public static final int BYTE_ORDER_BIG_ENDIAN = BYTE_ORDER_MOTOROLA;
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConversions.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConversions.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConversions.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConversions.java Sat May 26 15:35:04 2012
@@ -20,12 +20,14 @@ public class BinaryConversions implement
     public static byte[] convertToByteArray(short[] values, int byteOrder) {
         return convertToByteArray(values, 0, values.length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(short[] values, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(short[] values, int length,
+            int byteOrder) {
         return convertToByteArray(values, 0, length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(short[] values, int offset, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(short[] values, int offset,
+            int length, int byteOrder) {
         byte[] result = new byte[length * 2];
         for (int i = 0; i < length; i++) {
             short value = values[offset + i];
@@ -40,16 +42,18 @@ public class BinaryConversions implement
         }
         return result;
     }
-    
+
     public static byte[] convertToByteArray(int[] values, int byteOrder) {
         return convertToByteArray(values, 0, values.length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(int[] values, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(int[] values, int length,
+            int byteOrder) {
         return convertToByteArray(values, 0, length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(int[] values, int offset, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(int[] values, int offset,
+            int length, int byteOrder) {
         byte[] result = new byte[length * 4];
         for (int i = 0; i < length; i++) {
             int value = values[offset + i];
@@ -72,12 +76,14 @@ public class BinaryConversions implement
     public static byte[] convertToByteArray(float[] values, int byteOrder) {
         return convertToByteArray(values, 0, values.length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(float[] values, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(float[] values, int length,
+            int byteOrder) {
         return convertToByteArray(values, 0, length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(float[] values, int offset, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(float[] values, int offset,
+            int length, int byteOrder) {
         byte[] result = new byte[values.length * 4];
         for (int i = 0; i < values.length; i++) {
             float value = values[i];
@@ -97,16 +103,18 @@ public class BinaryConversions implement
         }
         return result;
     }
-    
+
     public static byte[] convertToByteArray(double[] values, int byteOrder) {
         return convertToByteArray(values, 0, values.length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(double[] values, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(double[] values, int length,
+            int byteOrder) {
         return convertToByteArray(values, 0, length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(double[] values, int offset, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(double[] values, int offset,
+            int length, int byteOrder) {
         byte[] result = new byte[length * 8];
         for (int i = 0; i < length; i++) {
             double value = values[offset + i];
@@ -134,16 +142,19 @@ public class BinaryConversions implement
         }
         return result;
     }
-    
-    public static byte[] convertToByteArray(RationalNumber[] values, int byteOrder) {
+
+    public static byte[] convertToByteArray(RationalNumber[] values,
+            int byteOrder) {
         return convertToByteArray(values, 0, values.length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(RationalNumber[] values, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(RationalNumber[] values,
+            int length, int byteOrder) {
         return convertToByteArray(values, 0, length, byteOrder);
     }
-    
-    public static byte[] convertToByteArray(RationalNumber[] values, int offset, int length, int byteOrder) {
+
+    public static byte[] convertToByteArray(RationalNumber[] values,
+            int offset, int length, int byteOrder) {
         byte[] result = new byte[length * 8];
         for (int i = 0; i < length; i++) {
             RationalNumber value = values[offset + i];
@@ -174,7 +185,7 @@ public class BinaryConversions implement
     public static short convertToShort(byte[] bytes, int byteOrder) {
         return convertToShort(bytes, 0, byteOrder);
     }
-    
+
     public static short convertToShort(byte[] bytes, int offset, int byteOrder) {
         int byte0 = 0xff & bytes[offset + 0];
         int byte1 = 0xff & bytes[offset + 1];
@@ -184,19 +195,21 @@ public class BinaryConversions implement
             return (short) ((byte1 << 8) | byte0);
         }
     }
-    
+
     public static short[] convertToShortArray(byte[] bytes, int byteOrder) {
         return convertToShortArray(bytes, 0, bytes.length, byteOrder);
     }
-    
-    public static short[] convertToShortArray(byte[] bytes, int length, int byteOrder) {
+
+    public static short[] convertToShortArray(byte[] bytes, int length,
+            int byteOrder) {
         return convertToShortArray(bytes, 0, length, byteOrder);
     }
-    
-    public static short[] convertToShortArray(byte[] bytes, int offset, int length, int byteOrder) {
+
+    public static short[] convertToShortArray(byte[] bytes, int offset,
+            int length, int byteOrder) {
         short[] result = new short[length / 2];
         for (int i = 0; i < result.length; i++) {
-            result[i] = convertToShort(bytes, offset + 2*i, byteOrder);
+            result[i] = convertToShort(bytes, offset + 2 * i, byteOrder);
         }
         return result;
     }
@@ -204,41 +217,41 @@ public class BinaryConversions implement
     public static int convertToInt(byte[] bytes, int byteOrder) {
         return convertToInt(bytes, 0, byteOrder);
     }
-    
+
     public static int convertToInt(byte[] bytes, int offset, int byteOrder) {
         int byte0 = 0xff & bytes[offset + 0];
         int byte1 = 0xff & bytes[offset + 1];
         int byte2 = 0xff & bytes[offset + 2];
         int byte3 = 0xff & bytes[offset + 3];
         if (byteOrder == BYTE_ORDER_MOTOROLA) {
-            return (byte0 << 24) | (byte1 << 16) |
-                    (byte2 << 8) | byte3;
+            return (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3;
         } else {
-            return (byte3 << 24) | (byte2 << 16) |
-                    (byte1 << 8) | byte0;
+            return (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0;
         }
     }
-    
+
     public static int[] convertToIntArray(byte[] bytes, int byteOrder) {
         return convertToIntArray(bytes, 0, bytes.length, byteOrder);
     }
-    
-    public static int[] convertToIntArray(byte[] bytes, int length, int byteOrder) {
+
+    public static int[] convertToIntArray(byte[] bytes, int length,
+            int byteOrder) {
         return convertToIntArray(bytes, 0, length, byteOrder);
     }
-    
-    public static int[] convertToIntArray(byte[] bytes, int offset, int length, int byteOrder) {
+
+    public static int[] convertToIntArray(byte[] bytes, int offset, int length,
+            int byteOrder) {
         int[] result = new int[length / 4];
         for (int i = 0; i < result.length; i++) {
-            result[i] = convertToInt(bytes, offset + 4*i, byteOrder);
+            result[i] = convertToInt(bytes, offset + 4 * i, byteOrder);
         }
         return result;
     }
-    
+
     public static float convertToFloat(byte[] bytes, int byteOrder) {
         return convertToFloat(bytes, 0, byteOrder);
     }
-    
+
     public static float convertToFloat(byte[] bytes, int offset, int byteOrder) {
         int byte0 = 0xff & bytes[offset + 0];
         int byte1 = 0xff & bytes[offset + 1];
@@ -246,35 +259,35 @@ public class BinaryConversions implement
         int byte3 = 0xff & bytes[offset + 3];
         int bits;
         if (byteOrder == BYTE_ORDER_MOTOROLA) {
-            bits = (byte0 << 24) | (byte1 << 16) |
-                    (byte2 << 8) | (byte3 << 0);
+            bits = (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | (byte3 << 0);
         } else {
-            bits = (byte3 << 24) | (byte2 << 16) |
-                    (byte1 << 8) | (byte0 << 0);
+            bits = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | (byte0 << 0);
         }
         return Float.intBitsToFloat(bits);
     }
-    
+
     public static float[] convertToFloatArray(byte[] bytes, int byteOrder) {
         return convertToFloatArray(bytes, 0, bytes.length, byteOrder);
     }
-    
-    public static float[] convertToFloatArray(byte[] bytes, int length, int byteOrder) {
+
+    public static float[] convertToFloatArray(byte[] bytes, int length,
+            int byteOrder) {
         return convertToFloatArray(bytes, 0, length, byteOrder);
     }
 
-    public static float[] convertToFloatArray(byte[] bytes, int offset, int length, int byteOrder) {
+    public static float[] convertToFloatArray(byte[] bytes, int offset,
+            int length, int byteOrder) {
         float[] result = new float[length / 4];
         for (int i = 0; i < result.length; i++) {
-            result[i] = convertToFloat(bytes, offset + 4*i, byteOrder);
+            result[i] = convertToFloat(bytes, offset + 4 * i, byteOrder);
         }
         return result;
     }
-    
+
     public static double convertToDouble(byte[] bytes, int byteOrder) {
         return convertToDouble(bytes, 0, byteOrder);
     }
-    
+
     public static double convertToDouble(byte[] bytes, int offset, int byteOrder) {
         long byte0 = 0xffL & bytes[offset + 0];
         long byte1 = 0xffL & bytes[offset + 1];
@@ -286,40 +299,41 @@ public class BinaryConversions implement
         long byte7 = 0xffL & bytes[offset + 7];
         long bits;
         if (byteOrder == BYTE_ORDER_MOTOROLA) {
-            bits = (byte0 << 56) | (byte1 << 48) |
-                    (byte2 << 40) | (byte3 << 32) |
-                    (byte4 << 24) | (byte5 << 16) |
-                    (byte6 << 8) | (byte7 << 0);
+            bits = (byte0 << 56) | (byte1 << 48) | (byte2 << 40)
+                    | (byte3 << 32) | (byte4 << 24) | (byte5 << 16)
+                    | (byte6 << 8) | (byte7 << 0);
         } else {
-            bits = (byte7 << 56) | (byte6 << 48) |
-                    (byte5 << 40) | (byte4 << 32) |
-                    (byte3 << 24) | (byte2 << 16) |
-                    (byte1 << 8) | (byte0 << 0);
+            bits = (byte7 << 56) | (byte6 << 48) | (byte5 << 40)
+                    | (byte4 << 32) | (byte3 << 24) | (byte2 << 16)
+                    | (byte1 << 8) | (byte0 << 0);
         }
         return Double.longBitsToDouble(bits);
     }
-    
+
     public static double[] convertToDoubleArray(byte[] bytes, int byteOrder) {
         return convertToDoubleArray(bytes, 0, bytes.length, byteOrder);
     }
-    
-    public static double[] convertToDoubleArray(byte[] bytes, int length, int byteOrder) {
+
+    public static double[] convertToDoubleArray(byte[] bytes, int length,
+            int byteOrder) {
         return convertToDoubleArray(bytes, 0, length, byteOrder);
     }
-    
-    public static double[] convertToDoubleArray(byte[] bytes, int offset, int length, int byteOrder) {
+
+    public static double[] convertToDoubleArray(byte[] bytes, int offset,
+            int length, int byteOrder) {
         double[] result = new double[length / 8];
         for (int i = 0; i < result.length; i++) {
-            result[i] = convertToDouble(bytes, offset + 8*i, byteOrder);
+            result[i] = convertToDouble(bytes, offset + 8 * i, byteOrder);
         }
         return result;
     }
-    
+
     public static RationalNumber convertToRational(byte[] bytes, int byteOrder) {
         return convertToRational(bytes, 0, byteOrder);
     }
-    
-    public static RationalNumber convertToRational(byte[] bytes, int offset, int byteOrder) {
+
+    public static RationalNumber convertToRational(byte[] bytes, int offset,
+            int byteOrder) {
         int byte0 = 0xff & bytes[offset + 0];
         int byte1 = 0xff & bytes[offset + 1];
         int byte2 = 0xff & bytes[offset + 2];
@@ -331,31 +345,30 @@ public class BinaryConversions implement
         int numerator;
         int divisor;
         if (byteOrder == BYTE_ORDER_MOTOROLA) {
-            numerator = (byte0 << 24) | (byte1 << 16) |
-                    (byte2 << 8) | byte3;
-            divisor = (byte4 << 24) | (byte5 << 16) |
-                    (byte6 << 8) | byte7;
+            numerator = (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3;
+            divisor = (byte4 << 24) | (byte5 << 16) | (byte6 << 8) | byte7;
         } else {
-            numerator = (byte3 << 24) | (byte2 << 16) |
-                    (byte1 << 8) | byte0;
-            divisor = (byte7 << 24) | (byte6 << 16) |
-                    (byte5 << 8) | byte4;
+            numerator = (byte3 << 24) | (byte2 << 16) | (byte1 << 8) | byte0;
+            divisor = (byte7 << 24) | (byte6 << 16) | (byte5 << 8) | byte4;
         }
         return new RationalNumber(numerator, divisor);
     }
-    
-    public static RationalNumber[] convertToRationalArray(byte[] bytes, int byteOrder) {
+
+    public static RationalNumber[] convertToRationalArray(byte[] bytes,
+            int byteOrder) {
         return convertToRationalArray(bytes, 0, bytes.length, byteOrder);
     }
-    
-    public static RationalNumber[] convertToRationalArray(byte[] bytes, int length, int byteOrder) {
+
+    public static RationalNumber[] convertToRationalArray(byte[] bytes,
+            int length, int byteOrder) {
         return convertToRationalArray(bytes, 0, length, byteOrder);
     }
-    
-    public static RationalNumber[] convertToRationalArray(byte[] bytes, int offset, int length, int byteOrder) {
+
+    public static RationalNumber[] convertToRationalArray(byte[] bytes,
+            int offset, int length, int byteOrder) {
         RationalNumber[] result = new RationalNumber[length / 8];
         for (int i = 0; i < result.length; i++) {
-            result[i] = convertToRational(bytes, offset + 8*i, byteOrder);
+            result[i] = convertToRational(bytes, offset + 8 * i, byteOrder);
         }
         return result;
     }



Mime
View raw message