Author: sebb Date: Fri Sep 10 01:37:40 2010 New Revision: 995635 URL: http://svn.apache.org/viewvc?rev=995635&view=rev Log: Tab police
Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELCH.java commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELab.java commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELuv.java commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMY.java commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMYK.java commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/common/PackBits.java Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELCH.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELCH.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELCH.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELCH.java Fri Sep 10 01:37:40 2010 @@ -18,17 +18,17 @@ package org.apache.sanselan.color; public final class ColorCIELCH { - public final double L, C, H; + public final double L, C, H; - public ColorCIELCH(double l, double C, double H) - { - L = l; - this.C = C; - this.H = H; - } + public ColorCIELCH(double l, double C, double H) + { + L = l; + this.C = C; + this.H = H; + } - public String toString() - { - return "{L: " + L + ", C: " + C + ", H: " + H + "}"; - } + public String toString() + { + return "{L: " + L + ", C: " + C + ", H: " + H + "}"; + } } \ No newline at end of file Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELab.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELab.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELab.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELab.java Fri Sep 10 01:37:40 2010 @@ -18,17 +18,17 @@ package org.apache.sanselan.color; public final class ColorCIELab { - public final double L, a, b; + public final double L, a, b; - public ColorCIELab(double l, double a, double b) - { - L = l; - this.a = a; - this.b = b; - } + public ColorCIELab(double l, double a, double b) + { + L = l; + this.a = a; + this.b = b; + } - public final String toString() - { - return "{L: " + L + ", a: " + a + ", b: " + b + "}"; - } + public final String toString() + { + return "{L: " + L + ", a: " + a + ", b: " + b + "}"; + } } \ No newline at end of file Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELuv.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELuv.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELuv.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCIELuv.java Fri Sep 10 01:37:40 2010 @@ -18,17 +18,17 @@ package org.apache.sanselan.color; public final class ColorCIELuv { - public final double L, u, v; + public final double L, u, v; - public ColorCIELuv(double l, double u, double v) - { - L = l; - this.u = u; - this.v = v; - } + public ColorCIELuv(double l, double u, double v) + { + L = l; + this.u = u; + this.v = v; + } - public String toString() - { - return "{L: " + L + ", u: " + u + ", v: " + v + "}"; - } + public String toString() + { + return "{L: " + L + ", u: " + u + ", v: " + v + "}"; + } } \ No newline at end of file Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMY.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMY.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMY.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMY.java Fri Sep 10 01:37:40 2010 @@ -18,17 +18,17 @@ package org.apache.sanselan.color; public final class ColorCMY { - public final double C, M, Y; + public final double C, M, Y; - public ColorCMY(double C, double M, double Y) - { - this.C = C; - this.M = M; - this.Y = Y; - } + public ColorCMY(double C, double M, double Y) + { + this.C = C; + this.M = M; + this.Y = Y; + } - public final String toString() - { - return "{C: " + C + ", M: " + M + ", Y: " + Y + "}"; - } + public final String toString() + { + return "{C: " + C + ", M: " + M + ", Y: " + Y + "}"; + } } \ No newline at end of file Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMYK.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMYK.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMYK.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/color/ColorCMYK.java Fri Sep 10 01:37:40 2010 @@ -18,18 +18,18 @@ package org.apache.sanselan.color; public final class ColorCMYK { - public final double C, M, Y, K; + public final double C, M, Y, K; - public ColorCMYK(double C, double M, double Y, double K) - { - this.C = C; - this.M = M; - this.Y = Y; - this.K = K; - } + public ColorCMYK(double C, double M, double Y, double K) + { + this.C = C; + this.M = M; + this.Y = Y; + this.K = K; + } - public final String toString() - { - return "{C: " + C + ", M: " + M + ", Y: " + Y + ", K: " + K + "}"; - } + public final String toString() + { + return "{C: " + C + ", M: " + M + ", Y: " + Y + ", K: " + K + "}"; + } } \ No newline at end of file Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/common/PackBits.java URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/common/PackBits.java?rev=995635&r1=995634&r2=995635&view=diff ============================================================================== --- commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/common/PackBits.java (original) +++ commons/proper/sanselan/trunk/src/main/java/org/apache/sanselan/common/PackBits.java Fri Sep 10 01:37:40 2010 @@ -24,147 +24,147 @@ import org.apache.sanselan.ImageReadExce public class PackBits { - public byte[] decompress(byte bytes[], int expected) - throws ImageReadException, IOException - { - int total = 0; - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - // Loop until you get the number of unpacked bytes you are expecting: - int i = 0; - while (total < expected) - - { - // Read the next source byte into n. - if (i >= bytes.length) - throw new ImageReadException( - "Tiff: Unpack bits source exhausted: " + i - + ", done + " + total + ", expected + " - + expected); - - int n = bytes[i++]; - // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. - if ((n >= 0) && (n <= 127)) - { - - int count = n + 1; - - total += count; - for (int j = 0; j < count; j++) - baos.write(bytes[i++]); - } - // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 - // times. - else if ((n >= -127) && (n <= -1)) - { - int b = bytes[i++]; - int count = -n + 1; - - total += count; - for (int j = 0; j < count; j++) - baos.write(b); - } - else if (n == -128) - throw new ImageReadException("Packbits: " + n); - // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 - // times. - // else - // Else if n is -128, noop. - } - byte result[] = baos.toByteArray(); - - return result; - - } - - private int findNextDuplicate(byte bytes[], int start) - { - // int last = -1; - if (start >= bytes.length) - return -1; - - byte prev = bytes[start]; - - for (int i = start + 1; i < bytes.length; i++) - { - byte b = bytes[i]; - - if (b == prev) - return i - 1; - - prev = b; - } - - return -1; - } - - private int findRunLength(byte bytes[], int start) - { - byte b = bytes[start]; - - int i; - - for (i = start + 1; (i < bytes.length) && (bytes[i] == b); i++) - ; - - return i - start; - } - - public byte[] compress(byte bytes[]) throws IOException - { - MyByteArrayOutputStream baos = new MyByteArrayOutputStream( - bytes.length * 2); // max length 1 extra byte for every 128 - - int ptr = 0; - int count = 0; - while (ptr < bytes.length) - { - count++; - int dup = findNextDuplicate(bytes, ptr); - - if (dup == ptr) // write run length - { - int len = findRunLength(bytes, dup); - int actual_len = Math.min(len, 128); - baos.write(-(actual_len - 1)); - baos.write(bytes[ptr]); - ptr += actual_len; - } - else - { // write literals - int len = dup - ptr; - - if (dup > 0) - { - int runlen = findRunLength(bytes, dup); - if (runlen < 3) // may want to discard next run. - { - int nextptr = ptr + len + runlen; - int nextdup = findNextDuplicate(bytes, nextptr); - if (nextdup != nextptr) // discard 2-byte run - { - dup = nextdup; - len = dup - ptr; - } - } - } - - if (dup < 0) - len = bytes.length - ptr; - int actual_len = Math.min(len, 128); - - baos.write(actual_len - 1); - for (int i = 0; i < actual_len; i++) - { - baos.write(bytes[ptr]); - ptr++; - } - } - } - byte result[] = baos.toByteArray(); + public byte[] decompress(byte bytes[], int expected) + throws ImageReadException, IOException + { + int total = 0; + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + // Loop until you get the number of unpacked bytes you are expecting: + int i = 0; + while (total < expected) + + { + // Read the next source byte into n. + if (i >= bytes.length) + throw new ImageReadException( + "Tiff: Unpack bits source exhausted: " + i + + ", done + " + total + ", expected + " + + expected); + + int n = bytes[i++]; + // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. + if ((n >= 0) && (n <= 127)) + { + + int count = n + 1; + + total += count; + for (int j = 0; j < count; j++) + baos.write(bytes[i++]); + } + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 + // times. + else if ((n >= -127) && (n <= -1)) + { + int b = bytes[i++]; + int count = -n + 1; + + total += count; + for (int j = 0; j < count; j++) + baos.write(b); + } + else if (n == -128) + throw new ImageReadException("Packbits: " + n); + // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 + // times. + // else + // Else if n is -128, noop. + } + byte result[] = baos.toByteArray(); + + return result; + + } + + private int findNextDuplicate(byte bytes[], int start) + { + // int last = -1; + if (start >= bytes.length) + return -1; + + byte prev = bytes[start]; + + for (int i = start + 1; i < bytes.length; i++) + { + byte b = bytes[i]; + + if (b == prev) + return i - 1; + + prev = b; + } + + return -1; + } + + private int findRunLength(byte bytes[], int start) + { + byte b = bytes[start]; + + int i; + + for (i = start + 1; (i < bytes.length) && (bytes[i] == b); i++) + ; + + return i - start; + } + + public byte[] compress(byte bytes[]) throws IOException + { + MyByteArrayOutputStream baos = new MyByteArrayOutputStream( + bytes.length * 2); // max length 1 extra byte for every 128 + + int ptr = 0; + int count = 0; + while (ptr < bytes.length) + { + count++; + int dup = findNextDuplicate(bytes, ptr); + + if (dup == ptr) // write run length + { + int len = findRunLength(bytes, dup); + int actual_len = Math.min(len, 128); + baos.write(-(actual_len - 1)); + baos.write(bytes[ptr]); + ptr += actual_len; + } + else + { // write literals + int len = dup - ptr; + + if (dup > 0) + { + int runlen = findRunLength(bytes, dup); + if (runlen < 3) // may want to discard next run. + { + int nextptr = ptr + len + runlen; + int nextdup = findNextDuplicate(bytes, nextptr); + if (nextdup != nextptr) // discard 2-byte run + { + dup = nextdup; + len = dup - ptr; + } + } + } + + if (dup < 0) + len = bytes.length - ptr; + int actual_len = Math.min(len, 128); + + baos.write(actual_len - 1); + for (int i = 0; i < actual_len; i++) + { + baos.write(bytes[ptr]); + ptr++; + } + } + } + byte result[] = baos.toByteArray(); - return result; + return result; - } + } } \ No newline at end of file