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/27 12:21:16 UTC
svn commit: r1545998 [3/5] - in /commons/proper/imaging/trunk/src:
main/java/org/apache/commons/imaging/
main/java/org/apache/commons/imaging/common/
main/java/org/apache/commons/imaging/common/mylzw/
main/java/org/apache/commons/imaging/formats/bmp/ m...
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java Wed Nov 27 11:21:14 2013
@@ -45,12 +45,11 @@ public class SosSegment extends Segment
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
}
- public SosSegment(final int marker, final int marker_length, final InputStream is)
- throws IOException {
- super(marker, marker_length);
+ public SosSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
+ super(marker, markerLength);
if (getDebug()) {
- System.out.println("SosSegment marker_length: " + marker_length);
+ System.out.println("SosSegment marker_length: " + markerLength);
}
// Debug.debug("SOS", marker_length);
@@ -62,19 +61,18 @@ public class SosSegment extends Segment
components = new Component[numberOfComponents];
for (int i = 0; i < numberOfComponents; i++) {
- final int scan_component_selector = readByte("scan_component_selector",
- is, "Not a Valid JPEG File");
- // Debug.debug("scan_component_selector", scan_component_selector);
+ final int scanComponentSelector = readByte("scanComponentSelector", is, "Not a Valid JPEG File");
+ // Debug.debug("scanComponentSelector", scanComponentSelector);
- final int ac_dc_entropy_coding_table_selector = readByte(
- "ac_dc_entrooy_coding_table_selector", is,
+ final int acDcEntropoyCodingTableSelector = readByte(
+ "acDcEntropoyCodingTableSelector", is,
"Not a Valid JPEG File");
// Debug.debug("ac_dc_entrooy_coding_table_selector",
- // ac_dc_entropy_coding_table_selector);
+ // acDcEntropoyCodingTableSelector);
- final int dcCodingTableSelector = (ac_dc_entropy_coding_table_selector >> 4) & 0xf;
- final int acCodingTableSelector = ac_dc_entropy_coding_table_selector & 0xf;
- components[i] = new Component(scan_component_selector,
+ final int dcCodingTableSelector = (acDcEntropoyCodingTableSelector >> 4) & 0xf;
+ final int acCodingTableSelector = acDcEntropoyCodingTableSelector & 0xf;
+ components[i] = new Component(scanComponentSelector,
dcCodingTableSelector, acCodingTableSelector);
}
@@ -84,13 +82,13 @@ public class SosSegment extends Segment
endOfSpectralSelection = readByte("end_of_spectral_selection", is,
"Not a Valid JPEG File");
// Debug.debug("end_of_spectral_selection", endOfSpectralSelection);
- final int successive_approximation_bit_position = readByte(
+ final int successiveApproximationBitPosition = readByte(
"successive_approximation_bit_position", is,
"Not a Valid JPEG File");
// Debug.debug("successive_approximation_bit_position",
// successive_approximation_bit_position);
- successiveApproximationBitHigh = (successive_approximation_bit_position >> 4) & 0xf;
- successiveApproximationBitLow = successive_approximation_bit_position & 0xf;
+ successiveApproximationBitHigh = (successiveApproximationBitPosition >> 4) & 0xf;
+ successiveApproximationBitLow = successiveApproximationBitPosition & 0xf;
if (getDebug()) {
System.out.println("");
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java Wed Nov 27 11:21:14 2013
@@ -20,9 +20,8 @@ import java.io.IOException;
import java.io.InputStream;
public class UnknownSegment extends GenericSegment {
- public UnknownSegment(final int marker, final int marker_length, final InputStream is)
- throws IOException {
- super(marker, marker_length, is);
+ public UnknownSegment(int marker, int markerLength, InputStream is) throws IOException {
+ super(marker, markerLength, is);
}
public UnknownSegment(final int marker, final byte[] bytes) {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegRewriter.java Wed Nov 27 11:21:14 2013
@@ -117,15 +117,15 @@ public class JpegRewriter extends Binary
}
public boolean isApp1Segment() {
- return marker == JpegConstants.JPEG_APP1_Marker;
+ return marker == JpegConstants.JPEG_APP1_MARKER;
}
public boolean isAppSegment() {
- return marker >= JpegConstants.JPEG_APP0_Marker && marker <= JpegConstants.JPEG_APP15_Marker;
+ return marker >= JpegConstants.JPEG_APP0_MARKER && marker <= JpegConstants.JPEG_APP15_MARKER;
}
public boolean isExifSegment() {
- if (marker != JpegConstants.JPEG_APP1_Marker) {
+ if (marker != JpegConstants.JPEG_APP1_MARKER) {
return false;
}
if (!startsWith(segmentData, JpegConstants.EXIF_IDENTIFIER_CODE)) {
@@ -135,7 +135,7 @@ public class JpegRewriter extends Binary
}
public boolean isPhotoshopApp13Segment() {
- if (marker != JpegConstants.JPEG_APP13_Marker) {
+ if (marker != JpegConstants.JPEG_APP13_MARKER) {
return false;
}
if (!new IptcParser().isPhotoshopJpegSegment(segmentData)) {
@@ -145,7 +145,7 @@ public class JpegRewriter extends Binary
}
public boolean isXmpSegment() {
- if (marker != JpegConstants.JPEG_APP1_Marker) {
+ if (marker != JpegConstants.JPEG_APP1_MARKER) {
return false;
}
if (!startsWith(segmentData, JpegConstants.XMP_IDENTIFIER)) {
@@ -323,7 +323,7 @@ public class JpegRewriter extends Binary
// private void writeSegment(OutputStream os, JFIFPieceSegment piece)
// throws ImageWriteException, IOException
// {
- // byte markerBytes[] = convertShortToByteArray(JPEG_APP1_Marker,
+ // byte markerBytes[] = convertShortToByteArray(JPEG_APP1_MARKER,
// JPEG_BYTE_ORDER);
// if (piece.segmentData.length > 0xffff)
// throw new JpegSegmentOverflowException("Jpeg segment is too long: "
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java Wed Nov 27 11:21:14 2013
@@ -182,7 +182,7 @@ public class JpegXmpRewriter extends Jpe
final int segmentSize = Math.min(xmpXmlBytes.length, JpegConstants.MAX_SEGMENT_SIZE);
final byte[] segmentData = writeXmpSegment(xmpXmlBytes, index,
segmentSize);
- newPieces.add(new JFIFPieceSegment(JpegConstants.JPEG_APP1_Marker, segmentData));
+ newPieces.add(new JFIFPieceSegment(JpegConstants.JPEG_APP1_MARKER, segmentData));
index += segmentSize;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/GammaCorrection.java Wed Nov 27 11:21:14 2013
@@ -21,19 +21,18 @@ public class GammaCorrection {
private final int[] lookupTable;
- public GammaCorrection(final double src_gamma, final double dst_gamma) {
+ public GammaCorrection(final double srcGamma, final double dstGamma) {
if (DEBUG) {
- System.out.println("src_gamma: " + src_gamma);
- System.out.println("dst_gamma: " + dst_gamma);
+ System.out.println("src_gamma: " + srcGamma);
+ System.out.println("dst_gamma: " + dstGamma);
}
lookupTable = new int[256];
for (int i = 0; i < 256; i++) {
- lookupTable[i] = correctSample(i, src_gamma, dst_gamma);
+ lookupTable[i] = correctSample(i, srcGamma, dstGamma);
if (DEBUG) {
- System.out
- .println("lookup_table[" + i + "]: " + lookupTable[i]);
+ System.out.println("lookup_table[" + i + "]: " + lookupTable[i]);
}
}
}
@@ -55,7 +54,7 @@ public class GammaCorrection {
return alpha | ((0xff & red) << 16) | ((0xff & green) << 8) | ((0xff & blue) << 0);
}
- private int correctSample(final int sample, final double src_gamma, final double dst_gamma) {
+ private int correctSample(final int sample, final double srcGamma, final double dstGamma) {
// if (kUseAdobeGammaMethod && val <= 32)
// {
// double slope = Math.round(255.0d * Math.pow((32.0 / 255.0d),
@@ -63,8 +62,7 @@ public class GammaCorrection {
// return (int) (sample * slope);
// }
- return (int) Math.round(255.0d * Math.pow((sample / 255.0d), src_gamma
- / dst_gamma));
+ return (int) Math.round(255.0d * Math.pow((sample / 255.0d), srcGamma / dstGamma));
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java Wed Nov 27 11:21:14 2013
@@ -127,14 +127,14 @@ public class PngImageParser extends Imag
}
}
- private boolean keepChunk(final int ChunkType, final int[] chunkTypes) {
+ private boolean keepChunk(final int chunkType, final int[] chunkTypes) {
// System.out.println("keepChunk: ");
if (chunkTypes == null) {
return true;
}
for (final int chunkType2 : chunkTypes) {
- if (chunkType2 == ChunkType) {
+ if (chunkType2 == chunkType) {
return true;
}
}
@@ -173,29 +173,29 @@ public class PngImageParser extends Imag
}
}
- final int CRC = read4Bytes("CRC", is, "Not a Valid PNG File");
+ final int crc = read4Bytes("CRC", is, "Not a Valid PNG File");
if (keep) {
if (chunkType == PngConstants.iCCP) {
- result.add(new PngChunkIccp(length, chunkType, CRC, bytes));
+ result.add(new PngChunkIccp(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.tEXt) {
- result.add(new PngChunkText(length, chunkType, CRC, bytes));
+ result.add(new PngChunkText(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.zTXt) {
- result.add(new PngChunkZtxt(length, chunkType, CRC, bytes));
+ result.add(new PngChunkZtxt(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.IHDR) {
- result.add(new PngChunkIhdr(length, chunkType, CRC, bytes));
+ result.add(new PngChunkIhdr(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.PLTE) {
- result.add(new PngChunkPlte(length, chunkType, CRC, bytes));
+ result.add(new PngChunkPlte(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.pHYs) {
- result.add(new PngChunkPhys(length, chunkType, CRC, bytes));
+ result.add(new PngChunkPhys(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.IDAT) {
- result.add(new PngChunkIdat(length, chunkType, CRC, bytes));
+ result.add(new PngChunkIdat(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.gAMA) {
- result.add(new PngChunkGama(length, chunkType, CRC, bytes));
+ result.add(new PngChunkGama(length, chunkType, crc, bytes));
} else if (chunkType == PngConstants.iTXt) {
- result.add(new PngChunkItxt(length, chunkType, CRC, bytes));
+ result.add(new PngChunkItxt(length, chunkType, crc, bytes));
} else {
- result.add(new PngChunk(length, chunkType, CRC, bytes));
+ result.add(new PngChunk(length, chunkType, crc, bytes));
}
if (returnAfterFirst) {
@@ -412,45 +412,44 @@ public class PngImageParser extends Imag
return result;
}
- private boolean hasAlphaChannel(final int ColorType) throws ImageReadException {
- switch (ColorType) {
- case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
- // sample.
- case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
- case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
- return false;
- case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
- // sample,
- // followed by an alpha sample.
- case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
- // triple,
- // followed by an alpha sample.
- return true;
- default:
- throw new ImageReadException("PNG: unknown color type: "
- + ColorType);
+ private boolean hasAlphaChannel(final int colorType) throws ImageReadException {
+ switch (colorType) {
+ case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
+ // sample.
+ case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
+ case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
+ return false;
+ case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
+ // sample,
+ // followed by an alpha sample.
+ case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
+ // triple,
+ // followed by an alpha sample.
+ return true;
+ default:
+ throw new ImageReadException("PNG: unknown color type: " + colorType);
}
}
- private String getColorTypeDescription(final int ColorType) {
- switch (ColorType) {
- case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
- // sample.
- return "grayscale";
- case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
- return "rgb";
- case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
- return "indexed rgb";
- case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
- // sample,
- // followed by an alpha sample.
- return "grayscale w/ alpha";
- case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
- // triple,
- // followed by an alpha sample.
- return "RGB w/ alpha";
- default:
- return "Unknown Color Type";
+ private String getColorTypeDescription(final int colorType) {
+ switch (colorType) {
+ case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
+ // sample.
+ return "grayscale";
+ case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
+ return "rgb";
+ case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
+ return "indexed rgb";
+ case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
+ // sample,
+ // followed by an alpha sample.
+ return "grayscale w/ alpha";
+ case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
+ // triple,
+ // followed by an alpha sample.
+ return "RGB w/ alpha";
+ default:
+ return "Unknown Color Type";
}
}
@@ -458,27 +457,22 @@ public class PngImageParser extends Imag
// BinaryFileParser
// I may not have always preserved byte order correctly.
- private TransparencyFilter getTransparencyFilter(final int ColorType,
- final PngChunk pngChunktRNS) throws ImageReadException, IOException {
- // this.printCharQuad("pngChunktRNS.ChunkType", pngChunktRNS.ChunkType);
- // this.debugNumber("pngChunktRNS.Length", pngChunktRNS.Length);
-
- switch (ColorType) {
- case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
- // sample.
- return new TransparencyFilterGrayscale(pngChunktRNS.getBytes());
- case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
- return new TransparencyFilterTrueColor(pngChunktRNS.getBytes());
- case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
- return new TransparencyFilterIndexedColor(pngChunktRNS.getBytes());
- case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
- // sample,
- case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
- // triple,
- default:
- throw new ImageReadException(
- "Simple Transparency not compatible with ColorType: "
- + ColorType);
+ private TransparencyFilter getTransparencyFilter(int colorType,
+ PngChunk pngChunktRNS) throws ImageReadException, IOException {
+ switch (colorType) {
+ case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
+ // sample.
+ return new TransparencyFilterGrayscale(pngChunktRNS.getBytes());
+ case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
+ return new TransparencyFilterTrueColor(pngChunktRNS.getBytes());
+ case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
+ return new TransparencyFilterIndexedColor(pngChunktRNS.getBytes());
+ case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
+ // sample,
+ case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
+ // triple,
+ default:
+ throw new ImageReadException("Simple Transparency not compatible with ColorType: " + colorType);
}
}
@@ -509,14 +503,14 @@ public class PngImageParser extends Imag
final PngChunkIhdr pngChunkIHDR = (PngChunkIhdr) IHDRs.get(0);
- boolean isTransparent = false;
+ boolean transparent = false;
final List<PngChunk> tRNSs = filterChunks(chunks, PngConstants.tRNS);
if (!tRNSs.isEmpty()) {
- isTransparent = true;
+ transparent = true;
} else {
// CE - Fix Alpha.
- isTransparent = hasAlphaChannel(pngChunkIHDR.colorType);
+ transparent = hasAlphaChannel(pngChunkIHDR.colorType);
// END FIX
}
@@ -553,20 +547,19 @@ public class PngImageParser extends Imag
textChunks.add(pngChunkiTXt.getContents());
}
- final int BitsPerPixel = pngChunkIHDR.bitDepth
- * samplesPerPixel(pngChunkIHDR.colorType);
- final ImageFormat Format = ImageFormats.PNG;
- final String FormatName = "PNG Portable Network Graphics";
- final int Height = pngChunkIHDR.height;
- final String MimeType = "image/png";
- final int NumberOfImages = 1;
- final int Width = pngChunkIHDR.width;
- final boolean isProgressive = (pngChunkIHDR.interlaceMethod != 0);
-
- int PhysicalHeightDpi = -1;
- float PhysicalHeightInch = -1;
- int PhysicalWidthDpi = -1;
- float PhysicalWidthInch = -1;
+ final int bitsPerPixel = pngChunkIHDR.bitDepth * samplesPerPixel(pngChunkIHDR.colorType);
+ final ImageFormat format = ImageFormats.PNG;
+ final String formatName = "PNG Portable Network Graphics";
+ final int height = pngChunkIHDR.height;
+ final String mimeType = "image/png";
+ final int numberOfImages = 1;
+ final int width = pngChunkIHDR.width;
+ final boolean progressive = (pngChunkIHDR.interlaceMethod != 0);
+
+ int physicalHeightDpi = -1;
+ float physicalHeightInch = -1;
+ int physicalWidthDpi = -1;
+ float physicalWidthInch = -1;
// if (pngChunkpHYs != null)
// {
@@ -578,19 +571,15 @@ public class PngImageParser extends Imag
// pngChunkpHYs.PixelsPerUnitXAxis );
// }
if ((pngChunkpHYs != null) && (pngChunkpHYs.unitSpecifier == 1)) { // meters
- final double meters_per_inch = 0.0254;
+ final double metersPerInch = 0.0254;
- PhysicalWidthDpi = (int) Math
- .round(pngChunkpHYs.pixelsPerUnitXAxis
- * meters_per_inch);
- PhysicalWidthInch = (float) (Width / (pngChunkpHYs.pixelsPerUnitXAxis * meters_per_inch));
- PhysicalHeightDpi = (int) Math
- .round(pngChunkpHYs.pixelsPerUnitYAxis
- * meters_per_inch);
- PhysicalHeightInch = (float) (Height / (pngChunkpHYs.pixelsPerUnitYAxis * meters_per_inch));
+ physicalWidthDpi = (int) Math.round(pngChunkpHYs.pixelsPerUnitXAxis * metersPerInch);
+ physicalWidthInch = (float) (width / (pngChunkpHYs.pixelsPerUnitXAxis * metersPerInch));
+ physicalHeightDpi = (int) Math.round(pngChunkpHYs.pixelsPerUnitYAxis * metersPerInch);
+ physicalHeightInch = (float) (height / (pngChunkpHYs.pixelsPerUnitYAxis * metersPerInch));
}
- final String FormatDetails = "Png";
+ final String formatDetails = "Png";
boolean usesPalette = false;
@@ -599,35 +588,34 @@ public class PngImageParser extends Imag
usesPalette = true;
}
- int ColorType;
+ int colorType;
switch (pngChunkIHDR.colorType) {
- case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
- // sample.
- case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a
- // grayscale sample,
- // followed by an alpha sample.
- ColorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
- break;
- case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
- case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette
- // index;
- case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an
- // R,G,B triple,
- // followed by an alpha sample.
- ColorType = ImageInfo.COLOR_TYPE_RGB;
- break;
- default:
- throw new ImageReadException("Png: Unknown ColorType: "
- + pngChunkIHDR.colorType);
+ case PngConstants.COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
+ // sample.
+ case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a
+ // grayscale sample,
+ // followed by an alpha sample.
+ colorType = ImageInfo.COLOR_TYPE_GRAYSCALE;
+ break;
+ case PngConstants.COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
+ case PngConstants.COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette
+ // index;
+ case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an
+ // R,G,B triple,
+ // followed by an alpha sample.
+ colorType = ImageInfo.COLOR_TYPE_RGB;
+ break;
+ default:
+ throw new ImageReadException("Png: Unknown ColorType: " + pngChunkIHDR.colorType);
}
final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_PNG_FILTER;
- return new PngImageInfo(FormatDetails, BitsPerPixel, comments,
- Format, FormatName, Height, MimeType, NumberOfImages,
- PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- PhysicalWidthInch, Width, isProgressive, isTransparent,
- usesPalette, ColorType, compressionAlgorithm, textChunks);
+ return new PngImageInfo(formatDetails, bitsPerPixel, comments,
+ format, formatName, height, mimeType, numberOfImages,
+ physicalHeightDpi, physicalHeightInch, physicalWidthDpi,
+ physicalWidthInch, width, progressive, transparent,
+ usesPalette, colorType, compressionAlgorithm, textChunks);
}
@Override
@@ -702,7 +690,7 @@ public class PngImageParser extends Imag
pngChunktRNS);
}
- ICC_Profile icc_profile = null;
+ ICC_Profile iccProfile = null;
GammaCorrection gammaCorrection = null;
{
final List<PngChunk> sRGBs = filterChunks(chunks, PngConstants.sRGB);
@@ -731,7 +719,7 @@ public class PngImageParser extends Imag
final PngChunkIccp pngChunkiCCP = (PngChunkIccp) iCCPs.get(0);
final byte[] bytes = pngChunkiCCP.uncompressedProfile;
- icc_profile = ICC_Profile.getInstance(bytes);
+ iccProfile = ICC_Profile.getInstance(bytes);
} else if (gAMAs.size() == 1) {
final PngChunkGama pngChunkgAMA = (PngChunkGama) gAMAs.get(0);
final double gamma = pngChunkgAMA.getGamma();
@@ -804,10 +792,10 @@ public class PngImageParser extends Imag
scanExpediter.drive();
- if (icc_profile != null) {
- final Boolean is_srgb = new IccProfileParser().issRGB(icc_profile);
+ if (iccProfile != null) {
+ final Boolean is_srgb = new IccProfileParser().issRGB(iccProfile);
if (is_srgb == null || !is_srgb.booleanValue()) {
- final ICC_ColorSpace cs = new ICC_ColorSpace(icc_profile);
+ final ICC_ColorSpace cs = new ICC_ColorSpace(iccProfile);
final ColorModel srgbCM = ColorModel.getRGBdefault();
final ColorSpace cs_sRGB = srgbCM.getColorSpace();
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java Wed Nov 27 11:21:14 2013
@@ -90,18 +90,18 @@ public class PngWriter {
private static class ImageHeader {
public final int width;
public final int height;
- public final byte bit_depth;
+ public final byte bitDepth;
public final byte colorType;
public final byte compressionMethod;
public final byte filterMethod;
public final byte interlaceMethod;
- public ImageHeader(final int width, final int height, final byte bit_depth,
+ public ImageHeader(final int width, final int height, final byte bitDepth,
final byte colorType, final byte compressionMethod, final byte filterMethod,
final byte interlaceMethod) {
this.width = width;
this.height = height;
- this.bit_depth = bit_depth;
+ this.bitDepth = bitDepth;
this.colorType = colorType;
this.compressionMethod = compressionMethod;
this.filterMethod = filterMethod;
@@ -115,7 +115,7 @@ public class PngWriter {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
writeInt(baos, value.width);
writeInt(baos, value.height);
- baos.write(0xff & value.bit_depth);
+ baos.write(0xff & value.bitDepth);
baos.write(0xff & value.colorType);
baos.write(0xff & value.compressionMethod);
baos.write(0xff & value.filterMethod);
@@ -494,7 +494,7 @@ public class PngWriter {
final byte bitDepth = getBitDepth(colorType, params);
if (verbose) {
- Debug.debug("bit_depth: " + bitDepth);
+ Debug.debug("bitDepth: " + bitDepth);
}
int sampleDepth;
@@ -504,7 +504,7 @@ public class PngWriter {
sampleDepth = bitDepth;
}
if (verbose) {
- Debug.debug("sample_depth: " + sampleDepth);
+ Debug.debug("sampleDepth: " + sampleDepth);
}
{
@@ -534,12 +534,12 @@ public class PngWriter {
if (colorType == PngConstants.COLOR_TYPE_INDEXED_COLOR) {
// PLTE No Before first IDAT
- final int max_colors = hasAlpha ? 255 : 256;
+ final int maxColors = hasAlpha ? 255 : 256;
final PaletteFactory paletteFactory = new PaletteFactory();
- palette = paletteFactory.makeQuantizedRgbPalette(src, max_colors);
+ palette = paletteFactory.makeQuantizedRgbPalette(src, maxColors);
// Palette palette2 = new PaletteFactory().makePaletteSimple(src,
- // max_colors);
+ // maxColors);
// palette.dump();
@@ -607,8 +607,8 @@ public class PngWriter {
// Debug.debug("y", y + "/" + height);
src.getRGB(0, y, width, 1, row, 0, width);
- final byte filter_type = PngConstants.FILTER_TYPE_NONE;
- baos.write(filter_type);
+ final byte filterType = PngConstants.FILTER_TYPE_NONE;
+ baos.write(filterType);
for (int x = 0; x < width; x++) {
final int argb = row[x];
@@ -658,9 +658,9 @@ public class PngWriter {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final DeflaterOutputStream dos = new DeflaterOutputStream(baos);
- final int chunk_size = 256 * 1024;
- for (int index = 0; index < uncompressed.length; index += chunk_size) {
- final int end = Math.min(uncompressed.length, index + chunk_size);
+ final int chunkSize = 256 * 1024;
+ for (int index = 0; index < uncompressed.length; index += chunkSize) {
+ final int end = Math.min(uncompressed.length, index + chunkSize);
final int length = end - index;
dos.write(uncompressed, index, length);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java Wed Nov 27 11:21:14 2013
@@ -45,7 +45,7 @@ public abstract class ScanExpediter exte
protected final TransparencyFilter transparencyFilter;
public ScanExpediter(final int width, final int height, final InputStream is,
- final BufferedImage bi, final int color_type, final int bitDepth, final int bitsPerPixel,
+ final BufferedImage bi, final int colorType, final int bitDepth, final int bitsPerPixel,
final PngChunkPlte pngChunkPLTE, final GammaCorrection gammaCorrection,
final TransparencyFilter transparencyFilter)
@@ -54,7 +54,7 @@ public abstract class ScanExpediter exte
this.height = height;
this.is = is;
this.bi = bi;
- this.colorType = color_type;
+ this.colorType = colorType;
this.bitDepth = bitDepth;
this.bytesPerPixel = this.getBitsToBytesRoundingUp(bitsPerPixel);
this.bitsPerPixel = bitsPerPixel;
@@ -171,43 +171,40 @@ public abstract class ScanExpediter exte
}
}
- protected ScanlineFilter getScanlineFilter(final int filter_type,
- final int BytesPerPixel) throws ImageReadException {
+ protected ScanlineFilter getScanlineFilter(int filterType, int bytesPerPixel) throws ImageReadException {
ScanlineFilter filter;
- switch (filter_type) {
- case 0: // None
- filter = new ScanlineFilterNone();
- break;
-
- case 1: // Sub
- filter = new ScanlineFilterSub(BytesPerPixel);
- break;
-
- case 2: // Up
- filter = new ScanlineFilterUp();
- break;
-
- case 3: // Average
- filter = new ScanlineFilterAverage(BytesPerPixel);
- break;
-
- case 4: // Paeth
- filter = new ScanlineFilterPaeth(BytesPerPixel);
- break;
-
- default:
- throw new ImageReadException("PNG: unknown filter_type: "
- + filter_type);
+ switch (filterType) {
+ case 0: // None
+ filter = new ScanlineFilterNone();
+ break;
+
+ case 1: // Sub
+ filter = new ScanlineFilterSub(bytesPerPixel);
+ break;
+
+ case 2: // Up
+ filter = new ScanlineFilterUp();
+ break;
+
+ case 3: // Average
+ filter = new ScanlineFilterAverage(bytesPerPixel);
+ break;
+
+ case 4: // Paeth
+ filter = new ScanlineFilterPaeth(bytesPerPixel);
+ break;
+ default:
+ throw new ImageReadException("PNG: unknown filterType: " + filterType);
}
return filter;
}
- protected byte[] unfilterScanline(final int filter_type, final byte[] src, final byte[] prev,
- final int BytesPerPixel) throws ImageReadException, IOException {
- final ScanlineFilter filter = getScanlineFilter(filter_type, BytesPerPixel);
+ protected byte[] unfilterScanline(final int filterType, final byte[] src, final byte[] prev,
+ final int bytesPerPixel) throws ImageReadException, IOException {
+ final ScanlineFilter filter = getScanlineFilter(filterType, bytesPerPixel);
final byte[] dst = new byte[src.length];
filter.unfilter(src, dst, prev);
@@ -215,7 +212,7 @@ public abstract class ScanExpediter exte
}
protected byte[] getNextScanline(final InputStream is, final int length, final byte[] prev,
- final int BytesPerPixel) throws ImageReadException, IOException {
+ final int bytesPerPixel) throws ImageReadException, IOException {
final int filterType = is.read();
if (filterType < 0) {
throw new ImageReadException("PNG: missing filter type");
@@ -223,7 +220,7 @@ public abstract class ScanExpediter exte
byte[] scanline = this.readBytes("scanline", is, length, "PNG: missing image data");
- return unfilterScanline(filterType, scanline, prev, BytesPerPixel);
+ return unfilterScanline(filterType, scanline, prev, bytesPerPixel);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterInterlaced.java Wed Nov 27 11:21:14 2013
@@ -32,20 +32,22 @@ public class ScanExpediterInterlaced ext
// private static final int Block_Height[] = { 8, 8, 4, 4, 2, 2, 1 };
// private static final int Block_Width[] = { 8, 4, 4, 2, 2, 1, 1 };
- public ScanExpediterInterlaced(final int width, final int height, final InputStream is,
- final BufferedImage bi, final int color_type, final int BitDepth, final int bits_per_pixel,
- final PngChunkPlte fPNGChunkPLTE, final GammaCorrection fGammaCorrection,
- final TransparencyFilter fTransparencyFilter)
+ public ScanExpediterInterlaced(int width, int height, InputStream is,
+ BufferedImage bi,
+ int colorType, int bitDepth, int bitsPerPixel,
+ PngChunkPlte fPNGChunkPLTE,
+ GammaCorrection gammaCorrection,
+ TransparencyFilter transparencyFilter)
{
- super(width, height, is, bi, color_type, BitDepth, bits_per_pixel,
- fPNGChunkPLTE, fGammaCorrection, fTransparencyFilter);
+ super(width, height, is, bi, colorType, bitDepth, bitsPerPixel,
+ fPNGChunkPLTE, gammaCorrection, transparencyFilter);
}
private void visit(final int x, final int y, final BufferedImage bi, final BitParser fBitParser,
- final int pixel_index_in_scanline)
+ final int pixelIndexInScanline)
throws ImageReadException, IOException {
- final int rgb = getRGB(fBitParser, pixel_index_in_scanline);
+ final int rgb = getRGB(fBitParser, pixelIndexInScanline);
bi.setRGB(x, y, rgb);
}
@@ -61,27 +63,25 @@ public class ScanExpediterInterlaced ext
//final boolean rows_in_pass = (y < height);
while (y < height) {
int x = STARTING_COL[pass - 1];
- int pixel_index_in_scanline = 0;
+ int pixelIndexInScanline = 0;
if (x < width) {
// only get data if there are pixels in this scanline/pass
- final int ColumnsInRow = 1 + ((width - STARTING_COL[pass - 1] - 1) / COL_INCREMENT[pass - 1]);
- final int bitsPerScanLine = bitsPerPixel * ColumnsInRow;
- final int pixel_bytes_per_scan_line = getBitsToBytesRoundingUp(bitsPerScanLine);
+ final int columnsInRow = 1 + ((width - STARTING_COL[pass - 1] - 1) / COL_INCREMENT[pass - 1]);
+ final int bitsPerScanLine = bitsPerPixel * columnsInRow;
+ final int pixelBytesPerScanLine = getBitsToBytesRoundingUp(bitsPerScanLine);
- final byte[] unfiltered = getNextScanline(is,
- pixel_bytes_per_scan_line, prev, bytesPerPixel);
+ final byte[] unfiltered = getNextScanline(is, pixelBytesPerScanLine, prev, bytesPerPixel);
prev = unfiltered;
- final BitParser fBitParser = new BitParser(unfiltered,
- bitsPerPixel, bitDepth);
+ final BitParser fBitParser = new BitParser(unfiltered, bitsPerPixel, bitDepth);
while (x < width) {
- visit(x, y, bi, fBitParser, pixel_index_in_scanline);
+ visit(x, y, bi, fBitParser, pixelIndexInScanline);
x = x + COL_INCREMENT[pass - 1];
- pixel_index_in_scanline++;
+ pixelIndexInScanline++;
}
}
y = y + ROW_INCREMENT[pass - 1];
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediterSimple.java Wed Nov 27 11:21:14 2013
@@ -26,12 +26,12 @@ import org.apache.commons.imaging.format
public class ScanExpediterSimple extends ScanExpediter {
public ScanExpediterSimple(final int width, final int height, final InputStream is,
- final BufferedImage bi, final int color_type, final int BitDepth, final int bitsPerPixel,
+ final BufferedImage bi, final int colorType, final int bitDepth, final int bitsPerPixel,
final PngChunkPlte pngChunkPLTE, final GammaCorrection gammaCorrection,
final TransparencyFilter transparencyFilter)
{
- super(width, height, is, bi, color_type, BitDepth, bitsPerPixel,
+ super(width, height, is, bi, colorType, bitDepth, bitsPerPixel,
pngChunkPLTE, gammaCorrection, transparencyFilter);
}
@@ -42,8 +42,7 @@ public class ScanExpediterSimple extends
byte[] prev = null;
for (int y = 0; y < height; y++) {
- final byte[] unfiltered = getNextScanline(is, pixelBytesPerScanLine,
- prev, bytesPerPixel);
+ final byte[] unfiltered = getNextScanline(is, pixelBytesPerScanLine, prev, bytesPerPixel);
prev = unfiltered;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java Wed Nov 27 11:21:14 2013
@@ -32,10 +32,10 @@ public class PngChunk extends BinaryFile
public final boolean reserved;
public final boolean safeToCopy;
- public PngChunk(final int length, final int chunkType, final int CRC, final byte[] bytes) {
+ public PngChunk(final int length, final int chunkType, final int crc, final byte[] bytes) {
this.length = length;
this.chunkType = chunkType;
- this.crc = CRC;
+ this.crc = crc;
this.bytes = bytes;
propertyBits = new boolean[4];
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkGama.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkGama.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkGama.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkGama.java Wed Nov 27 11:21:14 2013
@@ -22,9 +22,9 @@ import java.io.IOException;
public class PngChunkGama extends PngChunk {
public final int gamma;
- public PngChunkGama(final int length, final int chunkType, final int CRC, final byte[] bytes)
+ public PngChunkGama(final int length, final int chunkType, final int crc, final byte[] bytes)
throws IOException {
- super(length, chunkType, CRC, bytes);
+ super(length, chunkType, crc, bytes);
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
gamma = read4Bytes("Gamma", is, "Not a Valid Png File: gAMA Corrupt");
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIccp.java Wed Nov 27 11:21:14 2013
@@ -32,30 +32,30 @@ public class PngChunkIccp extends PngChu
public PngChunkIccp(
// PngImageParser parser,
- final int length, final int chunkType, final int CRC, final byte[] bytes)
+ final int length, final int chunkType, final int crc, final byte[] bytes)
throws ImageReadException, IOException {
- super(length, chunkType, CRC, bytes);
+ super(length, chunkType, crc, bytes);
// this.parser = parser;
final int index = findNull(bytes);
if (index < 0) {
throw new ImageReadException("PngChunkIccp: No Profile Name");
}
- final byte[] name_bytes = new byte[index];
- System.arraycopy(bytes, 0, name_bytes, 0, index);
- profileName = new String(name_bytes, "ISO-8859-1");
+ final byte[] nameBytes = new byte[index];
+ System.arraycopy(bytes, 0, nameBytes, 0, index);
+ profileName = new String(nameBytes, "ISO-8859-1");
compressionMethod = bytes[index + 1];
- final int CompressedProfileLength = bytes.length - (index + 1 + 1);
- compressedProfile = new byte[CompressedProfileLength];
- System.arraycopy(bytes, index + 1 + 1, compressedProfile, 0, CompressedProfileLength);
+ final int compressedProfileLength = bytes.length - (index + 1 + 1);
+ compressedProfile = new byte[compressedProfileLength];
+ System.arraycopy(bytes, index + 1 + 1, compressedProfile, 0, compressedProfileLength);
if (getDebug()) {
System.out.println("ProfileName: " + profileName);
System.out.println("ProfileName.length(): " + profileName.length());
System.out.println("CompressionMethod: " + compressionMethod);
- System.out.println("CompressedProfileLength: " + CompressedProfileLength);
+ System.out.println("CompressedProfileLength: " + compressedProfileLength);
System.out.println("bytes.length: " + bytes.length);
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIdat.java Wed Nov 27 11:21:14 2013
@@ -17,7 +17,8 @@
package org.apache.commons.imaging.formats.png.chunks;
public class PngChunkIdat extends PngChunk {
- public PngChunkIdat(final int length, final int chunkType, final int CRC, final byte[] bytes) {
- super(length, chunkType, CRC, bytes);
+
+ public PngChunkIdat(int length, int chunkType, int crc, byte[] bytes) {
+ super(length, chunkType, crc, bytes);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkIhdr.java Wed Nov 27 11:21:14 2013
@@ -28,9 +28,8 @@ public class PngChunkIhdr extends PngChu
public final int filterMethod;
public final int interlaceMethod;
- public PngChunkIhdr(final int length, final int chunkType, final int CRC, final byte[] bytes)
- throws IOException {
- super(length, chunkType, CRC, bytes);
+ public PngChunkIhdr(int length, int chunkType, int crc, byte[] bytes) throws IOException {
+ super(length, chunkType, crc, bytes);
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
width = read4Bytes("Width", is, "Not a Valid Png File: IHDR Corrupt");
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPhys.java Wed Nov 27 11:21:14 2013
@@ -24,9 +24,8 @@ public class PngChunkPhys extends PngChu
public final int pixelsPerUnitYAxis;
public final int unitSpecifier;
- public PngChunkPhys(final int Length, final int ChunkType, final int CRC, final byte[] bytes)
- throws IOException {
- super(Length, ChunkType, CRC, bytes);
+ public PngChunkPhys(int length, int chunkType, int crc, byte[] bytes) throws IOException {
+ super(length, chunkType, crc, bytes);
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java Wed Nov 27 11:21:14 2013
@@ -25,9 +25,9 @@ import org.apache.commons.imaging.format
public class PngChunkPlte extends PngChunk {
private final int[] rgb;
- public PngChunkPlte(final int length, final int ChunkType, final int CRC, final byte[] bytes)
+ public PngChunkPlte(final int length, final int chunkType, final int crc, final byte[] bytes)
throws ImageReadException, IOException {
- super(length, ChunkType, CRC, bytes);
+ super(length, chunkType, crc, bytes);
final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngTextChunk.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngTextChunk.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngTextChunk.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngTextChunk.java Wed Nov 27 11:21:14 2013
@@ -20,9 +20,8 @@ import org.apache.commons.imaging.format
public abstract class PngTextChunk extends PngChunk {
- public PngTextChunk(final int Length, final int chunkType, final int CRC, final byte[] bytes) {
- super(Length, chunkType, CRC, bytes);
-
+ public PngTextChunk(final int length, final int chunkType, final int crc, final byte[] bytes) {
+ super(length, chunkType, crc, bytes);
}
public abstract String getKeyword();
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterAverage.java Wed Nov 27 11:21:14 2013
@@ -32,19 +32,19 @@ public class ScanlineFilterAverage exten
throws ImageReadException, IOException {
for (int i = 0; i < src.length; i++) {
int raw = 0;
- final int prev_index = i - bytesPerPixel;
- if (prev_index >= 0) {
- raw = dst[prev_index];
+ final int prevIndex = i - bytesPerPixel;
+ if (prevIndex >= 0) {
+ raw = dst[prevIndex];
}
- int Prior = 0;
+ int prior = 0;
if (up != null) {
- Prior = up[i];
+ prior = up[i];
}
- final int Average = ((0xff & raw) + (0xff & Prior)) / 2;
+ final int average = ((0xff & raw) + (0xff & prior)) / 2;
- dst[i] = (byte) ((src[i] + Average) % 256);
+ dst[i] = (byte) ((src[i] + average) % 256);
// dst[i] = src[i];
// dst[i] = (byte) 255;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterPaeth.java Wed Nov 27 11:21:14 2013
@@ -27,7 +27,7 @@ public class ScanlineFilterPaeth extends
this.bytesPerPixel = bytesPerPixel;
}
- private int PaethPredictor(final int a, final int b, final int c) {
+ private int paethPredictor(final int a, final int b, final int c) {
// ; a = left, b = above, c = upper left
final int p = a + b - c; // ; initial estimate
final int pa = Math.abs(p - a); // ; distances to a, b, c
@@ -49,9 +49,9 @@ public class ScanlineFilterPaeth extends
throws ImageReadException, IOException {
for (int i = 0; i < src.length; i++) {
int left = 0;
- final int prev_index = i - bytesPerPixel;
- if (prev_index >= 0) {
- left = dst[prev_index];
+ final int prevIndex = i - bytesPerPixel;
+ if (prevIndex >= 0) {
+ left = dst[prevIndex];
}
int above = 0;
@@ -61,16 +61,15 @@ public class ScanlineFilterPaeth extends
// above = 255;
int upperleft = 0;
- if ((prev_index >= 0) && (up != null)) {
- upperleft = up[prev_index];
+ if ((prevIndex >= 0) && (up != null)) {
+ upperleft = up[prevIndex];
}
// upperleft = 255;
- final int PaethPredictor = PaethPredictor(0xff & left, 0xff & above,
- 0xff & upperleft);
+ int paethPredictor = paethPredictor(0xff & left, 0xff & above, 0xff & upperleft);
- dst[i] = (byte) ((src[i] + PaethPredictor) % 256);
- // dst[i] = (byte) ((src[i] + PaethPredictor) );
+ dst[i] = (byte) ((src[i] + paethPredictor) % 256);
+ // dst[i] = (byte) ((src[i] + paethPredictor) );
// dst[i] = src[i];
// dst[i] = (byte) 0;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/scanlinefilters/ScanlineFilterSub.java Wed Nov 27 11:21:14 2013
@@ -31,17 +31,17 @@ public class ScanlineFilterSub extends S
public void unfilter(final byte[] src, final byte[] dst, final byte[] up)
throws ImageReadException, IOException {
for (int i = 0; i < src.length; i++) {
- final int prev_index = i - bytesPerPixel;
- if (prev_index >= 0) {
- dst[i] = (byte) ((src[i] + dst[prev_index]) % 256);
- // dst[i] = 0xff & (src[i] + src[prev_index]);
+ final int prevIndex = i - bytesPerPixel;
+ if (prevIndex >= 0) {
+ dst[i] = (byte) ((src[i] + dst[prevIndex]) % 256);
+ // dst[i] = 0xff & (src[i] + src[prevIndex]);
} else {
dst[i] = src[i];
}
// if(i<10)
// System.out.println("\t" + i + ": " + dst[i] + " (" + src[i] +
- // ", " + prev_index + ")");
+ // ", " + prevIndex + ")");
// dst[i] = src[i];
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterGrayscale.java Wed Nov 27 11:21:14 2013
@@ -22,20 +22,18 @@ import java.io.IOException;
import org.apache.commons.imaging.ImageReadException;
public class TransparencyFilterGrayscale extends TransparencyFilter {
- private final int transparent_color;
+ private final int transparentColor;
- public TransparencyFilterGrayscale(final byte[] bytes) throws IOException {
+ public TransparencyFilterGrayscale(byte[] bytes) throws IOException {
super(bytes);
- final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
- transparent_color = read2Bytes("transparent_color", is,
- "tRNS: Missing transparent_color");
+ ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+ transparentColor = read2Bytes("transparentColor", is, "tRNS: Missing transparentColor");
}
@Override
- public int filter(final int rgb, final int index) throws ImageReadException,
- IOException {
- if (index != transparent_color) {
+ public int filter(final int rgb, final int index) throws ImageReadException, IOException {
+ if (index != transparentColor) {
return rgb;
}
return 0x00;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/transparencyfilters/TransparencyFilterTrueColor.java Wed Nov 27 11:21:14 2013
@@ -22,29 +22,26 @@ import java.io.IOException;
import org.apache.commons.imaging.ImageReadException;
public class TransparencyFilterTrueColor extends TransparencyFilter {
- private final int transparent_color;
+ private final int transparentColor;
- public TransparencyFilterTrueColor(final byte[] bytes) throws IOException {
+ public TransparencyFilterTrueColor(byte[] bytes) throws IOException {
super(bytes);
- final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
- final int transparent_red = read2Bytes("transparent_red", is,
- "tRNS: Missing transparent_color");
- final int transparent_green = read2Bytes("transparent_green", is,
- "tRNS: Missing transparent_color");
- final int transparent_blue = read2Bytes("transparent_blue", is,
- "tRNS: Missing transparent_color");
-
- transparent_color = ((0xff & transparent_red) << 16)
- | ((0xff & transparent_green) << 8)
- | ((0xff & transparent_blue) << 0);
+ ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+ int transparentRed = read2Bytes("transparentRed", is, "tRNS: Missing transparentColor");
+ int transparentGreen = read2Bytes("transparentGreen", is, "tRNS: Missing transparentColor");
+ int transparentBlue = read2Bytes("transparentBlue", is, "tRNS: Missing transparentColor");
+
+ transparentColor = ((0xff & transparentRed) << 16)
+ | ((0xff & transparentGreen) << 8)
+ | ((0xff & transparentBlue) << 0);
}
@Override
public int filter(final int rgb, final int sample) throws ImageReadException,
IOException {
- if ((0x00ffffff & rgb) == transparent_color) {
+ if ((0x00ffffff & rgb) == transparentColor) {
return 0x00;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java Wed Nov 27 11:21:14 2013
@@ -23,13 +23,14 @@ import org.apache.commons.imaging.ImageF
import org.apache.commons.imaging.common.ImageBuilder;
public abstract class FileInfo {
- protected final int width, height;
- protected final boolean RAWBITS;
+ protected final int width;
+ protected final int height;
+ protected final boolean rawbits;
- public FileInfo(final int width, final int height, final boolean RAWBITS) {
+ public FileInfo(final int width, final int height, final boolean rawbits) {
this.width = width;
this.height = height;
- this.RAWBITS = RAWBITS;
+ this.rawbits = rawbits;
}
public abstract boolean hasAlpha();
@@ -86,7 +87,7 @@ public abstract class FileInfo {
// try
// {
- if (!RAWBITS) {
+ if (!rawbits) {
final WhiteSpaceReader wsr = new WhiteSpaceReader(is);
for (int y = 0; y < height; y++) {
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java Wed Nov 27 11:21:14 2013
@@ -24,11 +24,11 @@ import org.apache.commons.imaging.ImageF
import org.apache.commons.imaging.ImageInfo;
public class PbmFileInfo extends FileInfo {
- private int bitcache = 0;
- private int bits_in_cache = 0;
+ private int bitcache;
+ private int bitsInCache;
- public PbmFileInfo(final int width, final int height, final boolean RAWBITS) {
- super(width, height, RAWBITS);
+ public PbmFileInfo(final int width, final int height, final boolean rawbits) {
+ super(width, height, rawbits);
}
@Override
@@ -69,23 +69,23 @@ public class PbmFileInfo extends FileInf
@Override
protected void newline() {
bitcache = 0;
- bits_in_cache = 0;
+ bitsInCache = 0;
}
@Override
public int getRGB(final InputStream is) throws IOException {
- if (bits_in_cache < 1) {
+ if (bitsInCache < 1) {
final int bits = is.read();
if (bits < 0) {
throw new IOException("PBM: Unexpected EOF");
}
bitcache = 0xff & bits;
- bits_in_cache += 8;
+ bitsInCache += 8;
}
final int bit = 0x1 & (bitcache >> 7);
bitcache <<= 1;
- bits_in_cache--;
+ bitsInCache--;
if (bit == 0) {
return 0xffffffff;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PbmWriter.java Wed Nov 27 11:21:14 2013
@@ -24,15 +24,15 @@ import java.util.Map;
import org.apache.commons.imaging.ImageWriteException;
public class PbmWriter extends PnmWriter {
- public PbmWriter(final boolean RAWBITS) {
- super(RAWBITS);
+ public PbmWriter(final boolean rawbits) {
+ super(rawbits);
}
@Override
public void writeImage(final BufferedImage src, final OutputStream os, final Map<String, Object> params)
throws ImageWriteException, IOException {
os.write(PnmConstants.PNM_PREFIX_BYTE);
- os.write(RAWBITS ? PnmConstants.PBM_RAW_CODE : PnmConstants.PBM_TEXT_CODE);
+ os.write(rawbits ? PnmConstants.PBM_RAW_CODE : PnmConstants.PBM_TEXT_CODE);
os.write(PnmConstants.PNM_SEPARATOR);
final int width = src.getWidth();
@@ -45,7 +45,7 @@ public class PbmWriter extends PnmWriter
os.write(PnmConstants.PNM_NEWLINE);
int bitcache = 0;
- int bits_in_cache = 0;
+ int bitsInCache = 0;
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
@@ -60,14 +60,14 @@ public class PbmWriter extends PnmWriter
sample = 1;
}
- if (RAWBITS) {
+ if (rawbits) {
bitcache = (bitcache << 1) | (0x1 & sample);
- bits_in_cache++;
+ bitsInCache++;
- if (bits_in_cache >= 8) {
+ if (bitsInCache >= 8) {
os.write((byte) bitcache);
bitcache = 0;
- bits_in_cache = 0;
+ bitsInCache = 0;
}
} else {
os.write(Integer.toString(sample).getBytes("US-ASCII")); // max
@@ -77,11 +77,11 @@ public class PbmWriter extends PnmWriter
}
}
- if ((RAWBITS) && (bits_in_cache > 0)) {
- bitcache = bitcache << (8 - bits_in_cache);
+ if (rawbits && (bitsInCache > 0)) {
+ bitcache = bitcache << (8 - bitsInCache);
os.write((byte) bitcache);
bitcache = 0;
- bits_in_cache = 0;
+ bitsInCache = 0;
}
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java Wed Nov 27 11:21:14 2013
@@ -29,8 +29,8 @@ public class PgmFileInfo extends FileInf
private final float scale;
private final int bytesPerSample;
- public PgmFileInfo(final int width, final int height, final boolean RAWBITS, final int max) throws ImageReadException {
- super(width, height, RAWBITS);
+ public PgmFileInfo(final int width, final int height, final boolean rawbits, final int max) throws ImageReadException {
+ super(width, height, rawbits);
if (max <= 0) {
throw new ImageReadException("PGM maxVal " + max
+ " is out of range [1;65535]");
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PgmWriter.java Wed Nov 27 11:21:14 2013
@@ -24,8 +24,9 @@ import java.util.Map;
import org.apache.commons.imaging.ImageWriteException;
public class PgmWriter extends PnmWriter {
- public PgmWriter(final boolean RAWBITS) {
- super(RAWBITS);
+
+ public PgmWriter(boolean rawbits) {
+ super(rawbits);
}
@Override
@@ -34,7 +35,7 @@ public class PgmWriter extends PnmWriter
// System.out.println
// (b1 == 0x50 && b2 == 0x36)
os.write(0x50);
- os.write(RAWBITS ? 0x35 : 0x32);
+ os.write(rawbits ? 0x35 : 0x32);
os.write(PnmConstants.PNM_SEPARATOR);
final int width = src.getWidth();
@@ -57,7 +58,7 @@ public class PgmWriter extends PnmWriter
final int blue = 0xff & (argb >> 0);
final int sample = (red + green + blue) / 3;
- if (RAWBITS) {
+ if (rawbits) {
os.write((byte) sample);
} else {
os.write(Integer.toString(sample).getBytes("US-ASCII")); // max component value
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=1545998&r1=1545997&r2=1545998&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 Wed Nov 27 11:21:14 2013
@@ -240,16 +240,16 @@ public class PnmImageParser extends Imag
throw new ImageReadException("PNM: Couldn't read Header");
}
- final List<String> Comments = new ArrayList<String>();
+ final List<String> comments = new ArrayList<String>();
- final int BitsPerPixel = info.getBitDepth() * info.getNumComponents();
- final ImageFormat Format = info.getImageType();
- final String FormatName = info.getImageTypeDescription();
- final String MimeType = info.getMIMEType();
- final int NumberOfImages = 1;
- final boolean isProgressive = false;
+ final int bitsPerPixel = info.getBitDepth() * info.getNumComponents();
+ final ImageFormat format = info.getImageType();
+ final String formatName = info.getImageTypeDescription();
+ final String mimeType = info.getMIMEType();
+ final int numberOfImages = 1;
+ final boolean progressive = false;
- // boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0);
+ // boolean progressive = (fPNGChunkIHDR.InterlaceMethod != 0);
//
final int PhysicalWidthDpi = 72;
final float PhysicalWidthInch = (float) ((double) info.width / (double) PhysicalWidthDpi);
@@ -264,10 +264,10 @@ public class PnmImageParser extends Imag
final int ColorType = info.getColorType();
final String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_NONE;
- return new ImageInfo(FormatDetails, BitsPerPixel, Comments,
- Format, FormatName, info.height, MimeType, NumberOfImages,
+ return new ImageInfo(FormatDetails, bitsPerPixel, comments,
+ format, formatName, info.height, mimeType, numberOfImages,
PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
- PhysicalWidthInch, info.width, isProgressive, isTransparent,
+ PhysicalWidthInch, info.width, progressive, isTransparent,
usesPalette, ColorType, compressionAlgorithm);
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmWriter.java Wed Nov 27 11:21:14 2013
@@ -24,10 +24,10 @@ import java.util.Map;
import org.apache.commons.imaging.ImageWriteException;
public abstract class PnmWriter {
- protected final boolean RAWBITS;
+ protected final boolean rawbits;
- public PnmWriter(final boolean RAWBITS) {
- this.RAWBITS = RAWBITS;
+ public PnmWriter(final boolean rawbits) {
+ this.rawbits = rawbits;
}
public abstract void writeImage(BufferedImage src, OutputStream os,
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java Wed Nov 27 11:21:14 2013
@@ -29,11 +29,10 @@ public class PpmFileInfo extends FileInf
private final float scale;
private final int bytesPerSample;
- public PpmFileInfo(final int width, final int height, final boolean RAWBITS, final int max) throws ImageReadException {
- super(width, height, RAWBITS);
+ public PpmFileInfo(final int width, final int height, final boolean rawbits, final int max) throws ImageReadException {
+ super(width, height, rawbits);
if (max <= 0) {
- throw new ImageReadException("PPM maxVal " + max
- + " is out of range [1;65535]");
+ throw new ImageReadException("PPM maxVal " + max + " is out of range [1;65535]");
} else if (max <= 255) {
scale = 255f;
bytesPerSample = 1;
@@ -41,8 +40,7 @@ public class PpmFileInfo extends FileInf
scale = 65535f;
bytesPerSample = 2;
} else {
- throw new ImageReadException("PPM maxVal " + max
- + " is out of range [1;65535]");
+ throw new ImageReadException("PPM maxVal " + max + " is out of range [1;65535]");
}
this.max = max;
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PpmWriter.java Wed Nov 27 11:21:14 2013
@@ -24,8 +24,9 @@ import java.util.Map;
import org.apache.commons.imaging.ImageWriteException;
public class PpmWriter extends PnmWriter {
- public PpmWriter(final boolean RAWBITS) {
- super(RAWBITS);
+
+ public PpmWriter(boolean rawbits) {
+ super(rawbits);
}
@Override
@@ -34,7 +35,7 @@ public class PpmWriter extends PnmWriter
// System.out.println
// (b1 == 0x50 && b2 == 0x36)
os.write(0x50);
- os.write(RAWBITS ? 0x36 : 0x33);
+ os.write(rawbits ? 0x36 : 0x33);
os.write(PnmConstants.PNM_SEPARATOR);
final int width = src.getWidth();
@@ -56,7 +57,7 @@ public class PpmWriter extends PnmWriter
final int green = 0xff & (argb >> 8);
final int blue = 0xff & (argb >> 0);
- if (RAWBITS) {
+ if (rawbits) {
os.write((byte) red);
os.write((byte) green);
os.write((byte) blue);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/ImageResourceType.java Wed Nov 27 11:21:14 2013
@@ -22,14 +22,13 @@ public class ImageResourceType {
public final int id;
public final String description;
- public ImageResourceType(final int id, final String Description) {
+ public ImageResourceType(int id, String description) {
this.id = id;
- this.description = Description;
+ this.description = description;
}
- public ImageResourceType(final int id, final int id2, final String Description)
- throws ImageReadException {
- this(id, Description);
+ public ImageResourceType(int id, int id2, String description) throws ImageReadException {
+ this(id, description);
if (id != id2) {
throw new ImageReadException("Mismatch ID: " + id + " ID2: " + id2);
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java?rev=1545998&r1=1545997&r2=1545998&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java Wed Nov 27 11:21:14 2013
@@ -21,28 +21,27 @@ import java.io.PrintWriter;
import java.nio.charset.Charset;
public class PsdHeaderInfo {
- public final int Version;
- private final byte[] Reserved;
- public final int Channels;
- public final int Rows;
- public final int Columns;
- public final int Depth;
- public final int Mode;
-
- public PsdHeaderInfo(final int Version, final byte[] Reserved, final int Channels, final int Rows,
- final int Columns, final int Depth, final int Mode) {
- this.Version = Version;
- this.Reserved = Reserved;
- this.Channels = Channels;
- this.Rows = Rows;
- this.Columns = Columns;
- this.Depth = Depth;
- this.Mode = Mode;
+ public final int version;
+ private final byte[] reserved;
+ public final int channels;
+ public final int rows;
+ public final int columns;
+ public final int depth;
+ public final int mode;
+
+ public PsdHeaderInfo(int version, byte[] reserved, int channels, int rows, int columns, int depth, int mode) {
+ this.version = version;
+ this.reserved = reserved;
+ this.channels = channels;
+ this.rows = rows;
+ this.columns = columns;
+ this.depth = depth;
+ this.mode = mode;
}
public byte[] getReserved() {
- return Reserved.clone();
+ return reserved.clone();
}
public void dump() {
@@ -54,16 +53,13 @@ public class PsdHeaderInfo {
public void dump(final PrintWriter pw) {
pw.println("");
pw.println("Header");
- pw.println("Version: " + Version + " (" + Integer.toHexString(Version)
- + ")");
- pw.println("Channels: " + Channels + " ("
- + Integer.toHexString(Channels) + ")");
- pw.println("Rows: " + Rows + " (" + Integer.toHexString(Rows) + ")");
- pw.println("Columns: " + Columns + " (" + Integer.toHexString(Columns)
- + ")");
- pw.println("Depth: " + Depth + " (" + Integer.toHexString(Depth) + ")");
- pw.println("Mode: " + Mode + " (" + Integer.toHexString(Mode) + ")");
- pw.println("Reserved: " + Reserved.length);
+ pw.println("Version: " + version + " (" + Integer.toHexString(version) + ")");
+ pw.println("Channels: " + channels + " (" + Integer.toHexString(channels) + ")");
+ pw.println("Rows: " + rows + " (" + Integer.toHexString(rows) + ")");
+ pw.println("Columns: " + columns + " (" + Integer.toHexString(columns) + ")");
+ pw.println("Depth: " + depth + " (" + Integer.toHexString(depth) + ")");
+ pw.println("Mode: " + mode + " (" + Integer.toHexString(mode) + ")");
+ pw.println("Reserved: " + reserved.length);
pw.println("");
pw.flush();