You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by eb...@apache.org on 2013/11/28 11:18:29 UTC
svn commit: r1546332 - in
/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging:
common/ common/itu_t4/ common/mylzw/ formats/bmp/ formats/bmp/pixelparsers/
formats/jpeg/ formats/jpeg/iptc/ formats/jpeg/segments/ formats/png/
formats/p...
Author: ebourg
Date: Thu Nov 28 10:18:29 2013
New Revision: 1546332
URL: http://svn.apache.org/r1546332
Log:
More style changes
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BasicCParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngCrc.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffReader.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReader.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroup.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroupCut.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutLongestAxisImplementation.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -109,7 +109,7 @@ public class BasicCParser {
boolean hadStar = false;
boolean hadBackSlash = false;
final ByteArrayOutputStream out = new ByteArrayOutputStream();
- boolean seenFirstComment = firstComment == null;
+ boolean seenFirstComment = (firstComment == null);
final StringBuilder directiveBuffer = new StringBuilder();
for (int c = is.read(); c != -1; c = is.read()) {
if (inComment) {
@@ -194,11 +194,10 @@ public class BasicCParser {
inDirective = false;
final 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 "
+ throw new ImageReadException("Invalid/unsupported "
+ "preprocessor directive '" + tokens[0] + "'");
}
defines.put(tokens[1], (tokens.length == 3) ? tokens[2]
@@ -236,8 +235,7 @@ public class BasicCParser {
inString = true;
} else if (c == '#') {
if (defines == null) {
- throw new ImageReadException(
- "Unexpected preprocessor directive");
+ throw new ImageReadException("Unexpected preprocessor directive");
}
inDirective = true;
} else {
@@ -260,12 +258,10 @@ public class BasicCParser {
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;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageMetadata.java Thu Nov 28 10:18:29 2013
@@ -64,7 +64,8 @@ public class ImageMetadata implements II
}
public static class Item implements IImageMetadataItem {
- private final String keyword, text;
+ private final String keyword;
+ private final String text;
public Item(final String keyword, final String text) {
this.keyword = keyword;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/T4AndT6Compression.java Thu Nov 28 10:18:29 2013
@@ -80,6 +80,7 @@ public final class T4AndT6Compression {
throws ImageWriteException {
int color = WHITE;
int runLength = 0;
+
for (int x = 0; x < width; x++) {
try {
final int nextColor = inputStream.readBits(1);
@@ -94,10 +95,10 @@ public final class T4AndT6Compression {
runLength = 1;
}
} catch (final IOException ioException) {
- throw new ImageWriteException(
- "Error reading image to compress", ioException);
+ throw new ImageWriteException("Error reading image to compress", ioException);
}
}
+
writeRunLength(outputStream, runLength, color);
}
@@ -114,8 +115,7 @@ public final class T4AndT6Compression {
*/
public static byte[] compressModifiedHuffman(final byte[] uncompressed,
final int width, final int height) throws ImageWriteException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(uncompressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
for (int y = 0; y < height; y++) {
compress1DLine(inputStream, outputStream, null, width);
@@ -160,8 +160,7 @@ public final class T4AndT6Compression {
inputStream.flushCache();
outputStream.flush();
} else if (rowLength > width) {
- throw new ImageReadException(
- "Unrecoverable row length error in image row " + y);
+ throw new ImageReadException("Unrecoverable row length error in image row " + y);
}
}
final byte[] ret = outputStream.toByteArray();
@@ -178,14 +177,14 @@ public final class T4AndT6Compression {
public static byte[] compressT4_1D(final byte[] uncompressed, final int width,
final int height, final boolean hasFill) throws ImageWriteException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(uncompressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
if (hasFill) {
T4_T6_Tables.EOL16.writeBits(outputStream);
} else {
T4_T6_Tables.EOL.writeBits(outputStream);
}
+
for (int y = 0; y < height; y++) {
compress1DLine(inputStream, outputStream, null, width);
if (hasFill) {
@@ -202,6 +201,7 @@ public final class T4AndT6Compression {
T4_T6_Tables.EOL.writeBits(outputStream);
inputStream.flushCache();
}
+
return outputStream.toByteArray();
}
@@ -217,17 +217,15 @@ public final class T4AndT6Compression {
*/
public static byte[] decompressT4_1D(final byte[] compressed, final int width,
final int height, final boolean hasFill) throws ImageReadException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(compressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(compressed));
BitArrayOutputStream outputStream = null;
boolean canThrow = false;
try {
outputStream = new BitArrayOutputStream();
for (int y = 0; y < height; y++) {
- T4_T6_Tables.Entry entry;
int rowLength;
try {
- entry = CONTROL_CODES.decode(inputStream);
+ T4_T6_Tables.Entry entry = CONTROL_CODES.decode(inputStream);
if (!isEOL(entry, hasFill)) {
throw new ImageReadException("Expected EOL not found");
}
@@ -265,8 +263,7 @@ public final class T4AndT6Compression {
public static byte[] compressT4_2D(final byte[] uncompressed, final int width,
final int height, final boolean hasFill, final int parameterK)
throws ImageWriteException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(uncompressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
int[] referenceLine = new int[width];
int[] codingLine = new int[width];
@@ -276,6 +273,7 @@ public final class T4AndT6Compression {
} else {
T4_T6_Tables.EOL.writeBits(outputStream);
}
+
for (int y = 0; y < height; y++) {
if (kCounter > 0) {
// 2D
@@ -284,16 +282,14 @@ public final class T4AndT6Compression {
try {
codingLine[i] = inputStream.readBits(1);
} catch (final IOException ioException) {
- throw new ImageWriteException(
- "Error reading image to compress", ioException);
+ throw new ImageWriteException("Error reading image to compress", ioException);
}
}
int codingA0Color = WHITE;
int referenceA0Color = WHITE;
int a1 = nextChangingElement(codingLine, codingA0Color, 0);
int b1 = nextChangingElement(referenceLine, referenceA0Color, 0);
- int b2 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ int b2 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
for (int a0 = 0; a0 < width;) {
if (b2 < a1) {
T4_T6_Tables.P.writeBits(outputStream);
@@ -321,30 +317,24 @@ public final class T4AndT6Compression {
codingA0Color = 1 - codingA0Color;
a0 = a1;
} else {
- final int a2 = nextChangingElement(codingLine,
- 1 - codingA0Color, a1 + 1);
+ final int a2 = nextChangingElement(codingLine, 1 - codingA0Color, a1 + 1);
final int a0a1 = a1 - a0;
final int a1a2 = a2 - a1;
T4_T6_Tables.H.writeBits(outputStream);
writeRunLength(outputStream, a0a1, codingA0Color);
- writeRunLength(outputStream, a1a2,
- 1 - codingA0Color);
+ writeRunLength(outputStream, a1a2, 1 - codingA0Color);
a0 = a2;
}
}
referenceA0Color = changingElementAt(referenceLine, a0);
a1 = nextChangingElement(codingLine, codingA0Color, a0 + 1);
if (codingA0Color == referenceA0Color) {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
} else {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
- b1 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
}
- b2 = nextChangingElement(referenceLine, 1 - codingA0Color,
- b1 + 1);
+ b2 = nextChangingElement(referenceLine, 1 - codingA0Color, b1 + 1);
}
final int[] swap = referenceLine;
referenceLine = codingLine;
@@ -372,6 +362,7 @@ public final class T4AndT6Compression {
}
inputStream.flushCache();
}
+
return outputStream.toByteArray();
}
@@ -389,15 +380,13 @@ public final class T4AndT6Compression {
*/
public static byte[] decompressT4_2D(final byte[] compressed, final int width,
final int height, final boolean hasFill) throws ImageReadException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(compressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(compressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
final int[] referenceLine = new int[width];
for (int y = 0; y < height; y++) {
- T4_T6_Tables.Entry entry;
int rowLength = 0;
try {
- entry = CONTROL_CODES.decode(inputStream);
+ T4_T6_Tables.Entry entry = CONTROL_CODES.decode(inputStream);
if (!isEOL(entry, hasFill)) {
throw new ImageReadException("Expected EOL not found");
}
@@ -406,28 +395,22 @@ public final class T4AndT6Compression {
// 2D
int codingA0Color = WHITE;
int referenceA0Color = WHITE;
- int b1 = nextChangingElement(referenceLine,
- referenceA0Color, 0);
- int b2 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ int b1 = nextChangingElement(referenceLine, referenceA0Color, 0);
+ int b2 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
for (int a0 = 0; a0 < width;) {
- int a1, a2;
+ int a1;
+ int a2;
entry = CONTROL_CODES.decode(inputStream);
if (entry == T4_T6_Tables.P) {
- fillRange(outputStream, referenceLine, a0, b2,
- codingA0Color);
+ fillRange(outputStream, referenceLine, a0, b2, codingA0Color);
a0 = b2;
} else if (entry == T4_T6_Tables.H) {
- final int a0a1 = readTotalRunLength(inputStream,
- codingA0Color);
+ final int a0a1 = readTotalRunLength(inputStream, codingA0Color);
a1 = a0 + a0a1;
- fillRange(outputStream, referenceLine, a0, a1,
- codingA0Color);
- final int a1a2 = readTotalRunLength(inputStream,
- 1 - codingA0Color);
+ fillRange(outputStream, referenceLine, a0, a1, codingA0Color);
+ final int a1a2 = readTotalRunLength(inputStream, 1 - codingA0Color);
a2 = a1 + a1a2;
- fillRange(outputStream, referenceLine, a1, a2,
- 1 - codingA0Color);
+ fillRange(outputStream, referenceLine, a1, a2, 1 - codingA0Color);
a0 = a2;
} else {
int a1b1;
@@ -446,28 +429,21 @@ public final class T4AndT6Compression {
} else if (entry == T4_T6_Tables.VR3) {
a1b1 = 3;
} else {
- throw new ImageReadException(
- "Invalid/unknown T.4 control code "
- + entry.bitString);
+ throw new ImageReadException("Invalid/unknown T.4 control code " + entry.bitString);
}
a1 = b1 + a1b1;
- fillRange(outputStream, referenceLine, a0, a1,
- codingA0Color);
+ fillRange(outputStream, referenceLine, a0, a1, codingA0Color);
a0 = a1;
codingA0Color = 1 - codingA0Color;
}
referenceA0Color = changingElementAt(referenceLine, a0);
if (codingA0Color == referenceA0Color) {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
} else {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
- b1 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
}
- b2 = nextChangingElement(referenceLine,
- 1 - codingA0Color, b1 + 1);
+ b2 = nextChangingElement(referenceLine, 1 - codingA0Color, b1 + 1);
rowLength = a0;
}
} else {
@@ -486,17 +462,16 @@ public final class T4AndT6Compression {
} catch (final IOException ioException) {
throw new ImageReadException("Decompression error", ioException);
} catch (final HuffmanTreeException huffmanException) {
- throw new ImageReadException("Decompression error",
- huffmanException);
+ throw new ImageReadException("Decompression error", huffmanException);
}
if (rowLength == width) {
outputStream.flush();
} else if (rowLength > width) {
- throw new ImageReadException(
- "Unrecoverable row length error in image row " + y);
+ throw new ImageReadException("Unrecoverable row length error in image row " + y);
}
}
+
return outputStream.toByteArray();
}
@@ -505,8 +480,7 @@ public final class T4AndT6Compression {
BitInputStreamFlexible inputStream = null;
boolean canThrow = false;
try {
- inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(uncompressed));
+ inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(uncompressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
int[] referenceLine = new int[width];
int[] codingLine = new int[width];
@@ -515,16 +489,14 @@ public final class T4AndT6Compression {
try {
codingLine[i] = inputStream.readBits(1);
} catch (final IOException ioException) {
- throw new ImageWriteException(
- "Error reading image to compress", ioException);
+ throw new ImageWriteException("Error reading image to compress", ioException);
}
}
int codingA0Color = WHITE;
int referenceA0Color = WHITE;
int a1 = nextChangingElement(codingLine, codingA0Color, 0);
int b1 = nextChangingElement(referenceLine, referenceA0Color, 0);
- int b2 = nextChangingElement(referenceLine, 1 - referenceA0Color,
- b1 + 1);
+ int b2 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
for (int a0 = 0; a0 < width;) {
if (b2 < a1) {
T4_T6_Tables.P.writeBits(outputStream);
@@ -552,8 +524,7 @@ public final class T4AndT6Compression {
codingA0Color = 1 - codingA0Color;
a0 = a1;
} else {
- final int a2 = nextChangingElement(codingLine,
- 1 - codingA0Color, a1 + 1);
+ final int a2 = nextChangingElement(codingLine, 1 - codingA0Color, a1 + 1);
final int a0a1 = a1 - a0;
final int a1a2 = a2 - a1;
T4_T6_Tables.H.writeBits(outputStream);
@@ -565,16 +536,12 @@ public final class T4AndT6Compression {
referenceA0Color = changingElementAt(referenceLine, a0);
a1 = nextChangingElement(codingLine, codingA0Color, a0 + 1);
if (codingA0Color == referenceA0Color) {
- b1 = nextChangingElement(referenceLine, referenceA0Color,
- a0 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
} else {
- b1 = nextChangingElement(referenceLine, referenceA0Color,
- a0 + 1);
- b1 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
}
- b2 = nextChangingElement(referenceLine, 1 - codingA0Color,
- b1 + 1);
+ b2 = nextChangingElement(referenceLine, 1 - codingA0Color, b1 + 1);
}
final int[] swap = referenceLine;
referenceLine = codingLine;
@@ -609,37 +576,30 @@ public final class T4AndT6Compression {
*/
public static byte[] decompressT6(final byte[] compressed, final int width, final int height)
throws ImageReadException {
- final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(
- new ByteArrayInputStream(compressed));
+ final BitInputStreamFlexible inputStream = new BitInputStreamFlexible(new ByteArrayInputStream(compressed));
final BitArrayOutputStream outputStream = new BitArrayOutputStream();
final int[] referenceLine = new int[width];
for (int y = 0; y < height; y++) {
- T4_T6_Tables.Entry entry;
int rowLength = 0;
try {
int codingA0Color = WHITE;
int referenceA0Color = WHITE;
int b1 = nextChangingElement(referenceLine, referenceA0Color, 0);
- int b2 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ int b2 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
for (int a0 = 0; a0 < width;) {
- int a1, a2;
- entry = CONTROL_CODES.decode(inputStream);
+ int a1;
+ int a2;
+ T4_T6_Tables.Entry entry = CONTROL_CODES.decode(inputStream);
if (entry == T4_T6_Tables.P) {
- fillRange(outputStream, referenceLine, a0, b2,
- codingA0Color);
+ fillRange(outputStream, referenceLine, a0, b2, codingA0Color);
a0 = b2;
} else if (entry == T4_T6_Tables.H) {
- final int a0a1 = readTotalRunLength(inputStream,
- codingA0Color);
+ final int a0a1 = readTotalRunLength(inputStream, codingA0Color);
a1 = a0 + a0a1;
- fillRange(outputStream, referenceLine, a0, a1,
- codingA0Color);
- final int a1a2 = readTotalRunLength(inputStream,
- 1 - codingA0Color);
+ fillRange(outputStream, referenceLine, a0, a1, codingA0Color);
+ final int a1a2 = readTotalRunLength(inputStream, 1 - codingA0Color);
a2 = a1 + a1a2;
- fillRange(outputStream, referenceLine, a1, a2,
- 1 - codingA0Color);
+ fillRange(outputStream, referenceLine, a1, a2, 1 - codingA0Color);
a0 = a2;
} else {
int a1b1;
@@ -658,42 +618,34 @@ public final class T4AndT6Compression {
} else if (entry == T4_T6_Tables.VR3) {
a1b1 = 3;
} else {
- throw new ImageReadException(
- "Invalid/unknown T.6 control code "
- + entry.bitString);
+ throw new ImageReadException("Invalid/unknown T.6 control code " + entry.bitString);
}
a1 = b1 + a1b1;
- fillRange(outputStream, referenceLine, a0, a1,
- codingA0Color);
+ fillRange(outputStream, referenceLine, a0, a1, codingA0Color);
a0 = a1;
codingA0Color = 1 - codingA0Color;
}
referenceA0Color = changingElementAt(referenceLine, a0);
if (codingA0Color == referenceA0Color) {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
} else {
- b1 = nextChangingElement(referenceLine,
- referenceA0Color, a0 + 1);
- b1 = nextChangingElement(referenceLine,
- 1 - referenceA0Color, b1 + 1);
+ b1 = nextChangingElement(referenceLine, referenceA0Color, a0 + 1);
+ b1 = nextChangingElement(referenceLine, 1 - referenceA0Color, b1 + 1);
}
- b2 = nextChangingElement(referenceLine, 1 - codingA0Color,
- b1 + 1);
+ b2 = nextChangingElement(referenceLine, 1 - codingA0Color, b1 + 1);
rowLength = a0;
}
} catch (final HuffmanTreeException huffmanException) {
- throw new ImageReadException("Decompression error",
- huffmanException);
+ throw new ImageReadException("Decompression error", huffmanException);
}
if (rowLength == width) {
outputStream.flush();
} else if (rowLength > width) {
- throw new ImageReadException(
- "Unrecoverable row length error in image row " + y);
+ throw new ImageReadException("Unrecoverable row length error in image row " + y);
}
}
+
return outputStream.toByteArray();
}
@@ -738,8 +690,7 @@ public final class T4AndT6Compression {
terminatingEntry.writeBits(bitStream);
}
- private static T4_T6_Tables.Entry lowerBound(final T4_T6_Tables.Entry[] entries,
- final int value) {
+ private static T4_T6_Tables.Entry lowerBound(final T4_T6_Tables.Entry[] entries, final int value) {
int first = 0;
int last = entries.length - 1;
do {
@@ -753,10 +704,11 @@ public final class T4AndT6Compression {
first = middle + 1;
}
} while (first < last);
+
return entries[first];
}
- private static int readTotalRunLength(final BitInputStreamFlexible bitStream,
+ private static int readTotalRunLength(final BitInputStreamFlexible bitStream,
final int color) throws ImageReadException {
try {
int totalLength = 0;
@@ -782,13 +734,13 @@ public final class T4AndT6Compression {
return line[position];
}
- private static int nextChangingElement(final int[] line, final int currentColour,
- final int start) {
+ private static int nextChangingElement(final int[] line, final int currentColour, final int start) {
int position;
for (position = start; position < line.length
&& line[position] == currentColour; position++) {
// noop
}
+
return position < line.length ? position : line.length;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java Thu Nov 28 10:18:29 2013
@@ -133,9 +133,9 @@ public final class MyLzwDecompressor {
tiffLZWMode = true;
}
- public byte[] decompress(final InputStream is, final int expectedLength)
- throws IOException {
- int code, oldCode = -1;
+ public byte[] decompress(final InputStream is, final int expectedLength) throws IOException {
+ int code;
+ int oldCode = -1;
final MyBitInputStream mbis = new MyBitInputStream(is, byteOrder);
if (tiffLZWMode) {
mbis.setTiffLZWMode();
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/BmpHeaderInfo.java Thu Nov 28 10:18:29 2013
@@ -58,7 +58,9 @@ public class BmpHeaderInfo {
public final int reservedV5;
public static class ColorSpaceCoordinate {
- public int x, y, z;
+ public int x;
+ public int y;
+ public int z;
}
public static class ColorSpace {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserBitFields.java Thu Nov 28 10:18:29 2013
@@ -67,7 +67,7 @@ public class PixelParserBitFields extend
maskLength++;
}
- return (trailingZeroes - (8 - maskLength));
+ return trailingZeroes - (8 - maskLength);
}
@Override
@@ -87,8 +87,7 @@ public class PixelParserBitFields extend
data = read2Bytes("Pixel", is, "BMP Image Data", ByteOrder.LITTLE_ENDIAN);
bytecount += 2;
} else {
- throw new ImageReadException("Unknown BitsPerPixel: "
- + bhi.bitsPerPixel);
+ throw new ImageReadException("Unknown BitsPerPixel: " + bhi.bitsPerPixel);
}
int red = (redMask & data);
@@ -101,14 +100,12 @@ public class PixelParserBitFields extend
blue = (blueShift >= 0) ? blue >> blueShift : blue << -blueShift;
alpha = (alphaShift >= 0) ? alpha >> alphaShift : alpha << -alphaShift;
- final int rgb = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
-
- return rgb;
+ return (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
}
@Override
public void newline() throws ImageReadException, IOException {
- while (((bytecount) % 4) != 0) {
+ while ((bytecount % 4) != 0) {
readByte("Pixel", is, "BMP Image Data");
bytecount++;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/PixelParserRle.java Thu Nov 28 10:18:29 2013
@@ -92,7 +92,8 @@ public class PixelParserRle extends Pixe
throws ImageReadException, IOException {
final int width = bhi.width;
final int height = bhi.height;
- int x = 0, y = height - 1;
+ int x = 0;
+ int y = height - 1;
boolean done = false;
while (!done) {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java Thu Nov 28 10:18:29 2013
@@ -196,12 +196,11 @@ public class JpegImageParser extends Ima
return result;
}
- private byte[] assembleSegments(final List<App2Segment> v)
- throws ImageReadException {
+ private byte[] assembleSegments(List<App2Segment> segments) throws ImageReadException {
try {
- return assembleSegments(v, false);
- } catch (final ImageReadException e) {
- return assembleSegments(v, true);
+ return assembleSegments(segments, false);
+ } catch (ImageReadException e) {
+ return assembleSegments(segments, true);
}
}
@@ -263,7 +262,7 @@ public class JpegImageParser extends Ima
for (int i = 0; i < v.size(); i++) {
final App2Segment segment = (App2Segment) v.get(i);
- Debug.debug((i) + ": " + segment.curMarker + " / " + segment.numMarkers);
+ Debug.debug(i + ": " + segment.curMarker + " / " + segment.numMarkers);
}
Debug.debug();
}
@@ -304,7 +303,7 @@ public class JpegImageParser extends Ima
System.out.println("");
}
- return (bytes);
+ return bytes;
}
@Override
@@ -917,8 +916,8 @@ public class JpegImageParser extends Ima
maxVerticalSamplingFactor = component.verticalSamplingFactor;
}
}
- final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor) ||
- (minVerticalSamplingFactor != maxVerticalSamplingFactor);
+ final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor)
+ || (minVerticalSamplingFactor != maxVerticalSamplingFactor);
if (numberOfComponents == 3) {
if (isSubsampled) {
colorType = ImageInfo.COLOR_TYPE_YCbCr;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java Thu Nov 28 10:18:29 2013
@@ -54,8 +54,8 @@ public class IptcParser extends BinaryFi
}
final int index = JpegConstants.PHOTOSHOP_IDENTIFICATION_STRING.size();
- return (index + 4) <= segmentData.length &&
- ByteConversions.toInt(segmentData, index, APP13_BYTE_ORDER) == JpegConstants.CONST_8BIM;
+ return (index + 4) <= segmentData.length
+ && ByteConversions.toInt(segmentData, index, APP13_BYTE_ORDER) == JpegConstants.CONST_8BIM;
}
/*
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App2Segment.java Thu Nov 28 10:18:29 2013
@@ -27,7 +27,8 @@ import static org.apache.commons.imaging
public class App2Segment extends AppnSegment implements Comparable<App2Segment> {
public final byte[] iccBytes;
- public final int curMarker, numMarkers;
+ public final int curMarker;
+ public final int numMarkers;
public App2Segment(final int marker, final byte[] segmentData)
throws ImageReadException, IOException {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java Thu Nov 28 10:18:29 2013
@@ -25,7 +25,8 @@ import org.apache.commons.imaging.format
import static org.apache.commons.imaging.common.BinaryFunctions.*;
public class SofnSegment extends Segment {
- public final int width, height;
+ public final int width;
+ public final int height;
public final int numberOfComponents;
public final int precision;
private final Component[] components;
@@ -45,8 +46,7 @@ public class SofnSegment extends Segment
}
}
- public SofnSegment(final int marker, final byte[] segmentData)
- throws IOException {
+ public SofnSegment(final int marker, final byte[] segmentData) throws IOException {
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngCrc.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngCrc.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngCrc.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngCrc.java Thu Nov 28 10:18:29 2013
@@ -27,7 +27,8 @@ class PngCrc {
/* Make the table for a fast CRC. */
private void make_crc_table() {
long c;
- int n, k;
+ int n;
+ int k;
for (n = 0; n < 256; n++) {
c = n;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngText.java Thu Nov 28 10:18:29 2013
@@ -17,7 +17,8 @@
package org.apache.commons.imaging.formats.png;
public abstract class PngText {
- public final String keyword, text;
+ public final String keyword;
+ public final String text;
public PngText(final String keyword, final String text) {
this.keyword = keyword;
@@ -52,8 +53,7 @@ public abstract class PngText {
public final String translatedKeyword;
- public Itxt(final String keyword, final String text, final String languageTag,
- final String translatedKeyword) {
+ public Itxt(final String keyword, final String text, final String languageTag, final String translatedKeyword) {
super(keyword, text);
this.languageTag = languageTag;
this.translatedKeyword = translatedKeyword;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java Thu Nov 28 10:18:29 2013
@@ -75,9 +75,9 @@ public class PnmImageParser extends Imag
@Override
protected ImageFormat[] getAcceptedTypes() {
return new ImageFormat[] {
- ImageFormats.PBM, //
- ImageFormats.PGM, //
- ImageFormats.PPM, //
+ ImageFormats.PBM,
+ ImageFormats.PGM,
+ ImageFormats.PPM,
ImageFormats.PNM,
ImageFormats.PAM
};
@@ -94,12 +94,12 @@ public class PnmImageParser extends Imag
final WhiteSpaceReader wsr = new WhiteSpaceReader(is);
- if (identifier2 == PnmConstants.PBM_TEXT_CODE ||
- identifier2 == PnmConstants.PBM_RAW_CODE ||
- identifier2 == PnmConstants.PGM_TEXT_CODE ||
- identifier2 == PnmConstants.PGM_RAW_CODE ||
- identifier2 == PnmConstants.PPM_TEXT_CODE ||
- identifier2 == PnmConstants.PPM_RAW_CODE) {
+ if (identifier2 == PnmConstants.PBM_TEXT_CODE
+ || identifier2 == PnmConstants.PBM_RAW_CODE
+ || identifier2 == PnmConstants.PGM_TEXT_CODE
+ || identifier2 == PnmConstants.PGM_RAW_CODE
+ || identifier2 == PnmConstants.PPM_TEXT_CODE
+ || identifier2 == PnmConstants.PPM_RAW_CODE) {
final int width = Integer.parseInt(wsr.readtoWhiteSpace());
final int height = Integer.parseInt(wsr.readtoWhiteSpace());
@@ -244,24 +244,24 @@ public class PnmImageParser extends Imag
// boolean progressive = (fPNGChunkIHDR.InterlaceMethod != 0);
//
- final int PhysicalWidthDpi = 72;
- final float PhysicalWidthInch = (float) ((double) info.width / (double) PhysicalWidthDpi);
- final int PhysicalHeightDpi = 72;
- final float PhysicalHeightInch = (float) ((double) info.height / (double) PhysicalHeightDpi);
+ final int physicalWidthDpi = 72;
+ final float physicalWidthInch = (float) ((double) info.width / (double) physicalWidthDpi);
+ final int physicalHeightDpi = 72;
+ final float physicalHeightInch = (float) ((double) info.height / (double) physicalHeightDpi);
- final String FormatDetails = info.getImageTypeDescription();
+ final String formatDetails = info.getImageTypeDescription();
final boolean transparent = info.hasAlpha();
final boolean usesPalette = false;
- final int ColorType = info.getColorType();
+ final int colorType = info.getColorType();
final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_NONE;
- return new ImageInfo(FormatDetails, bitsPerPixel, comments,
+ return new ImageInfo(formatDetails, bitsPerPixel, comments,
format, formatName, info.height, mimeType, numberOfImages,
- PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- PhysicalWidthInch, info.width, progressive, transparent,
- usesPalette, ColorType, compressionAlgorithm);
+ physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
+ physicalWidthInch, info.width, progressive, transparent,
+ usesPalette, colorType, compressionAlgorithm);
}
@Override
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -113,9 +113,7 @@ class RgbeInfo implements Closeable {
final String value = info.substring(equals + 1);
if ("FORMAT".equals(value) && !"32-bit_rle_rgbe".equals(value)) {
- throw new ImageReadException(
- "Only 32-bit_rle_rgbe images are supported, trying to read " +
- value);
+ throw new ImageReadException("Only 32-bit_rle_rgbe images are supported, trying to read " + value);
}
metadata.add(variable, value);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java Thu Nov 28 10:18:29 2013
@@ -53,12 +53,11 @@ public class TiffDirectory extends TiffE
public final long nextDirectoryOffset;
private TiffImageData tiffImageData;
private JpegImageData jpegImageData;
-
- public TiffDirectory(final int type, final List<TiffField> entries, final long offset,
- final long nextDirectoryOffset) {
- super(offset, TiffConstants.TIFF_DIRECTORY_HEADER_LENGTH +
- entries.size() * TiffConstants.TIFF_ENTRY_LENGTH +
- TiffConstants.TIFF_DIRECTORY_FOOTER_LENGTH);
+
+ public TiffDirectory(int type, List<TiffField> entries, long offset, long nextDirectoryOffset) {
+ super(offset, TiffConstants.TIFF_DIRECTORY_HEADER_LENGTH
+ + entries.size() * TiffConstants.TIFF_ENTRY_LENGTH
+ + TiffConstants.TIFF_DIRECTORY_FOOTER_LENGTH);
this.type = type;
this.entries = Collections.unmodifiableList(entries);
@@ -675,13 +674,11 @@ public class TiffDirectory extends TiffE
}
}
- public ImageDataElement getJpegRawImageDataElement()
- throws ImageReadException {
- final TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
- final TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
+ public ImageDataElement getJpegRawImageDataElement() throws ImageReadException {
+ TiffField jpegInterchangeFormat = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT);
+ TiffField jpegInterchangeFormatLength = findField(TiffTagConstants.TIFF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH);
- if ((jpegInterchangeFormat != null)
- && (jpegInterchangeFormatLength != null)) {
+ if (jpegInterchangeFormat != null && jpegInterchangeFormatLength != null) {
final int offSet = jpegInterchangeFormat.getIntArrayValue()[0];
final int byteCount = jpegInterchangeFormatLength.getIntArrayValue()[0];
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -510,15 +510,11 @@ public class TiffImageParser extends Ima
final Map<String, Object> params)
throws ImageReadException
{
- Integer ix0, iy0, iwidth, iheight;
- ix0 = getIntegerParameter(
- TiffConstants.PARAM_KEY_SUBIMAGE_X, params);
- iy0 = getIntegerParameter(
- TiffConstants.PARAM_KEY_SUBIMAGE_Y, params);
- iwidth = getIntegerParameter(
- TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, params);
- iheight = getIntegerParameter(
- TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, params);
+ Integer ix0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_X, params);
+ Integer iy0 = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_Y, params);
+ Integer iwidth = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_WIDTH, params);
+ Integer iheight = getIntegerParameter(TiffConstants.PARAM_KEY_SUBIMAGE_HEIGHT, params);
+
if (ix0 == null && iy0 == null && iwidth == null && iheight == null) {
return null;
}
@@ -538,9 +534,7 @@ public class TiffImageParser extends Ima
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
- throw new ImageReadException(
- "Incomplete subimage parameters, missing"
- + sb.toString());
+ throw new ImageReadException("Incomplete subimage parameters, missing" + sb.toString());
}
return new Rectangle(ix0, iy0, iwidth, iheight);
@@ -558,12 +552,10 @@ public class TiffImageParser extends Ima
final int photometricInterpretation = 0xffff & directory.getSingleFieldValue(
TiffTagConstants.TIFF_TAG_PHOTOMETRIC_INTERPRETATION);
- final int compression = 0xffff & directory.getSingleFieldValue(
- TiffTagConstants.TIFF_TAG_COMPRESSION);
- final int width = directory.getSingleFieldValue(
- TiffTagConstants.TIFF_TAG_IMAGE_WIDTH);
- final int height = directory.getSingleFieldValue(
- TiffTagConstants.TIFF_TAG_IMAGE_LENGTH);
+ final int compression = 0xffff & directory.getSingleFieldValue(TiffTagConstants.TIFF_TAG_COMPRESSION);
+ final int width = directory.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_WIDTH);
+ final int height = directory.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_LENGTH);
+
Rectangle subImage = checkForSubImage(params);
if (subImage != null) {
// Check for valid subimage specification. The following checks
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -48,8 +48,7 @@ public class TiffReader extends BinaryFi
this.strict = strict;
}
- private TiffHeader readTiffHeader(final ByteSource byteSource) throws ImageReadException,
- IOException {
+ private TiffHeader readTiffHeader(final ByteSource byteSource) throws ImageReadException, IOException {
InputStream is = null;
boolean canThrow = false;
try {
@@ -87,7 +86,8 @@ public class TiffReader extends BinaryFi
throw new ImageReadException("Unknown Tiff Version: " + tiffVersion);
}
- final long offsetToFirstIFD = 0xFFFFffffL & read4Bytes("offsetToFirstIFD", is, "Not a Valid TIFF File", getByteOrder());
+ final long offsetToFirstIFD =
+ 0xFFFFffffL & read4Bytes("offsetToFirstIFD", is, "Not a Valid TIFF File", getByteOrder());
skipBytes(is, offsetToFirstIFD - 8, "Not a Valid TIFF File: couldn't find IFDs");
@@ -110,8 +110,7 @@ public class TiffReader extends BinaryFi
final int dirType = TiffDirectoryConstants.DIRECTORY_TYPE_ROOT;
final List<Number> visited = new ArrayList<Number>();
- readDirectory(byteSource, offset, dirType, formatCompliance, listener,
- visited);
+ readDirectory(byteSource, offset, dirType, formatCompliance, listener, visited);
}
private boolean readDirectory(final ByteSource byteSource, final long offset,
@@ -184,14 +183,13 @@ public class TiffReader extends BinaryFi
final long valueLength = count * fieldType.getSize();
final byte[] value;
if (valueLength > TIFF_ENTRY_MAX_VALUE_LENGTH) {
- if ((offset < 0) ||
- (offset + valueLength) > byteSource.getLength()) {
+ if ((offset < 0) || (offset + valueLength) > byteSource.getLength()) {
if (strict) {
throw new IOException(
- "Attempt to read byte range starting from " + offset + " " +
- "of length " + valueLength + " " +
- "which is outside the file's size of " +
- byteSource.getLength());
+ "Attempt to read byte range starting from " + offset + " "
+ + "of length " + valueLength + " "
+ + "which is outside the file's size of "
+ + byteSource.getLength());
} else {
// corrupt field, ignore it
continue;
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -43,7 +43,8 @@ public abstract class DataReader {
protected final int predictor;
protected final int samplesPerPixel;
- protected final int width, height;
+ protected final int width;
+ protected final int height;
public DataReader(final TiffDirectory directory,
final PhotometricInterpreter photometricInterpreter, final int[] bitsPerSample,
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java Thu Nov 28 10:18:29 2013
@@ -126,7 +126,8 @@ public final class DataReaderTiled exten
final int pixelsPerTile = tileWidth * tileLength;
- int tileX = 0, tileY = 0;
+ int tileX = 0;
+ int tileY = 0;
int[] samples = new int[bitsPerSample.length];
resetPredictor();
@@ -164,7 +165,8 @@ public final class DataReaderTiled exten
final int bitsPerRow = tileWidth * bitsPerPixel;
final int bytesPerRow = (bitsPerRow + 7) / 8;
final int bytesPerTile = bytesPerRow * tileLength;
- int x = 0, y = 0;
+ int x = 0;
+ int y = 0;
for (final DataElement tile2 : imageData.tiles) {
final byte[] compressed = tile2.getData();
@@ -193,7 +195,8 @@ public final class DataReaderTiled exten
final int bitsPerRow = tileWidth * bitsPerPixel;
final int bytesPerRow = (bitsPerRow + 7) / 8;
final int bytesPerTile = bytesPerRow * tileLength;
- int x = 0, y = 0;
+ int x = 0;
+ int y = 0;
// tileWidth is the width of the tile
// tileLength is the height of the tile
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java Thu Nov 28 10:18:29 2013
@@ -108,8 +108,7 @@ public final class TagInfoGpsText extend
encoding = TEXT_ENCODING_UNICODE_LE;
}
final byte[] unicodeBytes = s.getBytes(encoding.encodingName);
- final byte[] result = new byte[unicodeBytes.length +
- encoding.prefix.length];
+ final byte[] result = new byte[unicodeBytes.length + encoding.prefix.length];
System.arraycopy(encoding.prefix, 0, result, 0, encoding.prefix.length);
System.arraycopy(unicodeBytes, 0, result, encoding.prefix.length, unicodeBytes.length);
return result;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java Thu Nov 28 10:18:29 2013
@@ -86,9 +86,9 @@ public class TiffImageWriterLossless ext
final TiffElement oversizeValue = field.getOversizeValueElement();
if (oversizeValue != null) {
final TiffOutputField frozenField = frozenFields.get(field.getTag());
- if (frozenField != null &&
- frozenField.getSeperateValue() != null &&
- frozenField.bytesEqual(field.getByteArrayValue())) {
+ if (frozenField != null
+ && frozenField.getSeperateValue() != null
+ && frozenField.bytesEqual(field.getByteArrayValue())) {
frozenField.getSeperateValue().setOffset(field.getOffset());
} else {
elements.add(oversizeValue);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/xpm/XpmImageParser.java Thu Nov 28 10:18:29 2013
@@ -397,12 +397,10 @@ public class XpmImageParser extends Imag
row.setLength(0);
final boolean hasMore = parseNextString(cParser, row);
if (!hasMore) {
- throw new ImageReadException("Parsing XPM file failed, "
- + "file ended while reading palette");
+ throw new ImageReadException("Parsing XPM file failed, " + "file ended while reading palette");
}
final String name = row.substring(0, xpmHeader.numCharsPerPixel);
- final String[] tokens = BasicCParser.tokenizeRow(
- row.substring(xpmHeader.numCharsPerPixel));
+ final String[] tokens = BasicCParser.tokenizeRow(row.substring(xpmHeader.numCharsPerPixel));
final PaletteEntry paletteEntry = new PaletteEntry();
paletteEntry.index = i;
int previousKeyIndex = Integer.MIN_VALUE;
@@ -410,10 +408,12 @@ public class XpmImageParser extends Imag
for (int j = 0; j < tokens.length; j++) {
final String token = tokens[j];
boolean isKey = false;
- if (previousKeyIndex < (j - 1) &&
- "m".equals(token) || "g4".equals(token) ||
- "g".equals(token) || "c".equals(token) ||
- "s".equals(token)) {
+ if (previousKeyIndex < (j - 1)
+ && "m".equals(token)
+ || "g4".equals(token)
+ || "g".equals(token)
+ || "c".equals(token)
+ || "s".equals(token)) {
isKey = true;
}
if (isKey) {
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -31,7 +31,8 @@ import org.apache.commons.imaging.util.I
public class IccTag {
public final int signature;
- public final int offset, length;
+ public final int offset;
+ public final int length;
public final IccTagType fIccTagType;
public byte[] data;
private IccTagDataType itdt;
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -46,8 +46,7 @@ class ColorGroup {
public final int diffTotal;
public final int totalPoints;
- public ColorGroup(final List<ColorCount> colorCounts, final boolean ignoreAlpha)
- throws ImageWriteException {
+ public ColorGroup(final List<ColorCount> colorCounts, final boolean ignoreAlpha) throws ImageWriteException {
this.colorCounts = colorCounts;
this.ignoreAlpha = ignoreAlpha;
@@ -77,9 +76,7 @@ class ColorGroup {
maxDiff = Math.max(
ignoreAlpha ? redDiff : Math.max(alphaDiff, redDiff),
Math.max(greenDiff, blueDiff));
- diffTotal = (ignoreAlpha ? 0 : alphaDiff) + redDiff + greenDiff
- + blueDiff;
-
+ diffTotal = (ignoreAlpha ? 0 : alphaDiff) + redDiff + greenDiff + blueDiff;
}
public boolean contains(final int argb) {
@@ -105,7 +102,10 @@ class ColorGroup {
public int getMedianValue() {
long countTotal = 0;
- long alphaTotal = 0, redTotal = 0, greenTotal = 0, blueTotal = 0;
+ long alphaTotal = 0;
+ long redTotal = 0;
+ long greenTotal = 0;
+ long blueTotal = 0;
for (ColorCount color : colorCounts) {
countTotal += color.count;
@@ -115,8 +115,7 @@ class ColorGroup {
blueTotal += color.count * color.blue;
}
- final int alpha = ignoreAlpha ? 0xff : (int) Math
- .round((double) alphaTotal / countTotal);
+ final int alpha = ignoreAlpha ? 0xff : (int) Math.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);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroupCut.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroupCut.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroupCut.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorGroupCut.java Thu Nov 28 10:18:29 2013
@@ -17,12 +17,12 @@
package org.apache.commons.imaging.palette;
class ColorGroupCut {
- public final ColorGroup less, more;
+ public final ColorGroup less;
+ public final ColorGroup more;
public final ColorComponent mode;
public final int limit;
- public ColorGroupCut(final ColorGroup less, final ColorGroup more, final ColorComponent mode,
- final int limit) {
+ public ColorGroupCut(final ColorGroup less, final ColorGroup more, final ColorComponent mode, final int limit) {
this.less = less;
this.more = more;
this.mode = mode;
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -132,7 +132,9 @@ class ColorSpaceSubset {
}
public void setAverageRGB(final int[] table) {
- long redsum = 0, greensum = 0, bluesum = 0;
+ long redsum = 0;
+ long greensum = 0;
+ long bluesum = 0;
for (int red = mins[0]; red <= maxs[0]; red++) {
for (int green = mins[1]; green <= maxs[1]; green++) {
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=1546332&r1=1546331&r2=1546332&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 Thu Nov 28 10:18:29 2013
@@ -64,23 +64,24 @@ public class MedianCutLongestAxisImpleme
final Comparator<ColorCount> comp = new Comparator<ColorCount>() {
public int compare(final ColorCount c1, final ColorCount c2) {
switch (mode) {
- case ALPHA:
- return c1.alpha - c2.alpha;
- case RED:
- return c1.red - c2.red;
- case GREEN:
- return c1.green - c2.green;
- case BLUE:
- return c1.blue - c2.blue;
- default:
- return 0;
+ case ALPHA:
+ return c1.alpha - c2.alpha;
+ case RED:
+ return c1.red - c2.red;
+ case GREEN:
+ return c1.green - c2.green;
+ case BLUE:
+ return c1.blue - c2.blue;
+ default:
+ return 0;
}
}
};
Collections.sort(colorGroup.colorCounts, comp);
final int countHalf = (int) Math.round((double) colorGroup.totalPoints / 2);
- int oldCount = 0, newCount = 0;
+ int oldCount = 0;
+ int newCount = 0;
int medianIndex;
for (medianIndex = 0; medianIndex < colorGroup.colorCounts.size(); medianIndex++) {
final ColorCount colorCount = colorGroup.colorCounts.get(medianIndex);
@@ -111,30 +112,28 @@ public class MedianCutLongestAxisImpleme
colorGroup.colorCounts.subList(medianIndex + 1,
colorGroup.colorCounts.size()));
- ColorGroup less, more;
- less = new ColorGroup(new ArrayList<ColorCount>(colorCounts1), ignoreAlpha);
+ ColorGroup less = new ColorGroup(new ArrayList<ColorCount>(colorCounts1), ignoreAlpha);
colorGroups.add(less);
- more = new ColorGroup(new ArrayList<ColorCount>(colorCounts2), ignoreAlpha);
+ ColorGroup more = new ColorGroup(new ArrayList<ColorCount>(colorCounts2), ignoreAlpha);
colorGroups.add(more);
- final ColorCount medianValue = colorGroup.colorCounts
- .get(medianIndex);
+ final ColorCount medianValue = colorGroup.colorCounts.get(medianIndex);
int limit;
switch (mode) {
- case ALPHA:
- limit = medianValue.alpha;
- break;
- case RED:
- limit = medianValue.red;
- break;
- case GREEN:
- limit = medianValue.green;
- break;
- case BLUE:
- limit = medianValue.blue;
- break;
- default:
- throw new Error("Bad mode.");
+ case ALPHA:
+ limit = medianValue.alpha;
+ break;
+ case RED:
+ limit = medianValue.red;
+ break;
+ case GREEN:
+ limit = medianValue.green;
+ break;
+ case BLUE:
+ limit = medianValue.blue;
+ break;
+ default:
+ throw new Error("Bad mode.");
}
colorGroup.cut = new ColorGroupCut(less, more, mode, limit);
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/MedianCutMostPopulatedBoxesImplementation.java Thu Nov 28 10:18:29 2013
@@ -53,7 +53,8 @@ public class MedianCutMostPopulatedBoxes
}
Collections.sort(colorGroup.colorCounts, new ColorComparer(colorComponent));
final int countHalf = (int) Math.round((double) colorGroup.totalPoints / 2);
- int oldCount = 0, newCount = 0;
+ int oldCount = 0;
+ int newCount = 0;
int medianIndex;
for (medianIndex = 0; medianIndex < colorGroup.colorCounts.size(); medianIndex++) {
final ColorCount colorCount = colorGroup.colorCounts.get(medianIndex);
@@ -111,24 +112,23 @@ public class MedianCutMostPopulatedBoxes
colorGroups.add(lowerGroup);
colorGroups.add(upperGroup);
- final ColorCount medianValue = colorGroup.colorCounts
- .get(bestMedianIndex);
+ final ColorCount medianValue = colorGroup.colorCounts.get(bestMedianIndex);
int limit;
switch (bestColorComponent) {
- case ALPHA:
- limit = medianValue.alpha;
- break;
- case RED:
- limit = medianValue.red;
- break;
- case GREEN:
- limit = medianValue.green;
- break;
- case BLUE:
- limit = medianValue.blue;
- break;
- default:
- throw new Error("Bad mode.");
+ case ALPHA:
+ limit = medianValue.alpha;
+ break;
+ case RED:
+ limit = medianValue.red;
+ break;
+ case GREEN:
+ limit = medianValue.green;
+ break;
+ case BLUE:
+ limit = medianValue.blue;
+ break;
+ default:
+ throw new Error("Bad mode.");
}
colorGroup.cut = new ColorGroupCut(lowerGroup, upperGroup, bestColorComponent, limit);
return true;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java?rev=1546332&r1=1546331&r2=1546332&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/PaletteFactory.java Thu Nov 28 10:18:29 2013
@@ -185,17 +185,15 @@ public class PaletteFactory {
final int[] sliceMaxs = new int[subset.maxs.length];
System.arraycopy(subset.maxs, 0, sliceMaxs, 0, subset.maxs.length);
- int sum1 = 0, sum2;
- int slice1, slice2;
+ int sum1 = 0;
+ int slice1;
int last = 0;
for (slice1 = subset.mins[component]; slice1 != subset.maxs[component] + 1; slice1++) {
-
sliceMins[component] = slice1;
sliceMaxs[component] = slice1;
- last = getFrequencyTotal(table, sliceMins, sliceMaxs,
- precision);
+ last = getFrequencyTotal(table, sliceMins, sliceMaxs, precision);
sum1 += last;
@@ -204,13 +202,11 @@ public class PaletteFactory {
}
}
- sum2 = sum1 - last;
- slice2 = slice1 - 1;
+ int sum2 = sum1 - last;
+ int slice2 = slice1 - 1;
- final DivisionCandidate dc1 = finishDivision(subset, component, precision,
- sum1, slice1);
- final DivisionCandidate dc2 = finishDivision(subset, component, precision,
- sum2, slice2);
+ final DivisionCandidate dc1 = finishDivision(subset, component, precision, sum1, slice1);
+ final DivisionCandidate dc2 = finishDivision(subset, component, precision, sum2, slice2);
final List<DivisionCandidate> result = new ArrayList<DivisionCandidate>();
@@ -259,7 +255,8 @@ public class PaletteFactory {
private static class DivisionCandidate {
// private final ColorSpaceSubset src;
- private final ColorSpaceSubset dst_a, dst_b;
+ private final ColorSpaceSubset dst_a;
+ private final ColorSpaceSubset dst_b;
public DivisionCandidate(final ColorSpaceSubset dst_a, final ColorSpaceSubset dst_b) {
// this.src = src;