You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by da...@apache.org on 2012/05/26 17:35:06 UTC
svn commit: r1342914 [1/5] - in
/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: ./
color/ common/ common/bytesource/ common/itu_t4/ common/mylzw/
Author: damjan
Date: Sat May 26 15:35:04 2012
New Revision: 1342914
URL: http://svn.apache.org/viewvc?rev=1342914&view=rev
Log:
Reformat some files to a common style.
Modified:
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ColorTools.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageFormat.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageReadException.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingException.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorConversions.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsl.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHsv.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorHunterLab.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorXyz.java
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/BinaryConstant.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConstants.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryConversions.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileFunctions.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryFileParser.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryInputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitArrayOutputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/BitInputStreamFlexible.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/Compression.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IBufferedImageFactory.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/IImageMetadata.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ImageBuilder.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/MyByteArrayOutputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/PackBits.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumber.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RationalNumberUtilities.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/RgbBufferedImageFactory.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/SimpleBufferedImageFactory.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/ZLibUtils.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSource.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceArray.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceFile.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/bytesource/ByteSourceInputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTree.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/itu_t4/HuffmanTreeException.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/itu_t4/T4_T6_Tables.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/BitsToByteInputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitInputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyBitOutputStream.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwCompressor.java
commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/common/mylzw/MyLzwDecompressor.java
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ColorTools.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ColorTools.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ColorTools.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ColorTools.java Sat May 26 15:35:04 2012
@@ -103,9 +103,9 @@ public class ColorTools {
return new ComponentColorModel(cs, false, false,
ComponentColorModel.OPAQUE, ccm.getTransferType());
else
- return new ComponentColorModel(cs, ccm.hasAlpha(), ccm
- .isAlphaPremultiplied(), ccm.getTransparency(), ccm
- .getTransferType());
+ return new ComponentColorModel(cs, ccm.hasAlpha(),
+ ccm.isAlphaPremultiplied(), ccm.getTransparency(),
+ ccm.getTransferType());
} else if (old_cm instanceof DirectColorModel) {
DirectColorModel dcm = (DirectColorModel) old_cm;
@@ -114,9 +114,9 @@ public class ColorTools {
int old_bits = count_bits_in_mask(old_mask);
- return new DirectColorModel(cs, old_bits, dcm.getRedMask(), dcm
- .getGreenMask(), dcm.getBlueMask(), dcm.getAlphaMask(), dcm
- .isAlphaPremultiplied(), dcm.getTransferType());
+ return new DirectColorModel(cs, old_bits, dcm.getRedMask(),
+ dcm.getGreenMask(), dcm.getBlueMask(), dcm.getAlphaMask(),
+ dcm.isAlphaPremultiplied(), dcm.getTransferType());
}
// else if (old_cm instanceof PackedColorModel)
// {
@@ -254,4 +254,4 @@ public class ColorTools {
return result;
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/FormatCompliance.java Sat May 26 15:35:04 2012
@@ -22,44 +22,37 @@ import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
-public class FormatCompliance
-{
+public class FormatCompliance {
private final boolean failOnError;
private final String description;
private final List<String> comments = new ArrayList<String>();
- public FormatCompliance(String description)
- {
+ public FormatCompliance(String description) {
this.description = description;
failOnError = false;
}
- public FormatCompliance(String description, boolean fail_on_error)
- {
+ public FormatCompliance(String description, boolean fail_on_error) {
this.description = description;
this.failOnError = fail_on_error;
}
- public static final FormatCompliance getDefault()
- {
+ public static final FormatCompliance getDefault() {
return new FormatCompliance("ignore", false);
}
- public void addComment(String s) throws ImageReadException
- {
+ public void addComment(String s) throws ImageReadException {
comments.add(s);
if (failOnError)
throw new ImageReadException(s);
}
- public void addComment(String s, int value) throws ImageReadException
- {
+ public void addComment(String s, int value) throws ImageReadException {
addComment(s + ": " + getValueDescription(value));
}
@Override
- public String toString()
- {
+ public String toString() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -68,19 +61,16 @@ public class FormatCompliance
return sw.getBuffer().toString();
}
- public void dump()
- {
+ public void dump() {
dump(new PrintWriter(new OutputStreamWriter(System.out)));
}
- public void dump(PrintWriter pw)
- {
+ public void dump(PrintWriter pw) {
pw.println("Format Compliance: " + description);
if (comments.size() == 0)
pw.println("\t" + "No comments.");
- else
- {
+ else {
for (int i = 0; i < comments.size(); i++)
pw.println("\t" + (i + 1) + ": " + comments.get(i));
}
@@ -88,29 +78,22 @@ public class FormatCompliance
pw.flush();
}
- private String getValueDescription(int value)
- {
+ private String getValueDescription(int value) {
return value + " (" + Integer.toHexString(value) + ")";
}
public boolean compare_bytes(String name, byte expected[], byte actual[])
- throws ImageReadException
- {
- if (expected.length != actual.length)
- {
+ throws ImageReadException {
+ if (expected.length != actual.length) {
addComment(name + ": " + "Unexpected length: (expected: "
+ expected.length + ", actual: " + actual.length + ")");
return false;
- }
- else
- {
- for (int i = 0; i < expected.length; i++)
- {
- // System.out.println("expected: "
- // + getValueDescription(expected[i]) + ", actual: "
- // + getValueDescription(actual[i]) + ")");
- if (expected[i] != actual[i])
- {
+ } else {
+ for (int i = 0; i < expected.length; i++) {
+ // System.out.println("expected: "
+ // + getValueDescription(expected[i]) + ", actual: "
+ // + getValueDescription(actual[i]) + ")");
+ if (expected[i] != actual[i]) {
addComment(name + ": " + "Unexpected value: (expected: "
+ getValueDescription(expected[i]) + ", actual: "
+ getValueDescription(actual[i]) + ")");
@@ -123,10 +106,8 @@ public class FormatCompliance
}
public boolean checkBounds(String name, int min, int max, int actual)
- throws ImageReadException
- {
- if ((actual < min) || (actual > max))
- {
+ throws ImageReadException {
+ if ((actual < min) || (actual > max)) {
addComment(name + ": " + "bounds check: " + min + " <= " + actual
+ " <= " + max + ": false");
return false;
@@ -136,16 +117,12 @@ public class FormatCompliance
}
public boolean compare(String name, int valid, int actual)
- throws ImageReadException
- {
- return compare(name, new int[]{
- valid,
- }, actual);
+ throws ImageReadException {
+ return compare(name, new int[] { valid, }, actual);
}
public boolean compare(String name, int valid[], int actual)
- throws ImageReadException
- {
+ throws ImageReadException {
for (int i = 0; i < valid.length; i++)
if (actual == valid[i])
return true;
@@ -154,8 +131,7 @@ public class FormatCompliance
result.append(name + ": " + "Unexpected value: (valid: ");
if (valid.length > 1)
result.append("{");
- for (int i = 0; i < valid.length; i++)
- {
+ for (int i = 0; i < valid.length; i++) {
if (i > 0)
result.append(", ");
result.append(getValueDescription(valid[i]));
@@ -166,4 +142,4 @@ public class FormatCompliance
addComment(result.toString());
return false;
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageDump.java Sat May 26 15:35:04 2012
@@ -24,41 +24,36 @@ import java.awt.image.BufferedImage;
import org.apache.commons.imaging.icc.IccProfileInfo;
import org.apache.commons.imaging.icc.IccProfileParser;
-public class ImageDump
-{
- private String colorSpaceTypeToName(ColorSpace cs)
- {
- // System.out.println(prefix + ": " + "type: "
- // + cs.getType() );
- switch (cs.getType())
- {
- case ColorSpace.TYPE_CMYK :
- return "TYPE_CMYK";
- case ColorSpace.TYPE_RGB :
- return "TYPE_RGB";
-
- case ColorSpace.CS_sRGB :
- return "CS_sRGB";
- case ColorSpace.CS_GRAY :
- return "CS_GRAY";
- case ColorSpace.CS_CIEXYZ :
- return "CS_CIEXYZ";
- case ColorSpace.CS_LINEAR_RGB :
- return "CS_LINEAR_RGB";
- case ColorSpace.CS_PYCC :
- return "CS_PYCC";
+public class ImageDump {
+ private String colorSpaceTypeToName(ColorSpace cs) {
+ // System.out.println(prefix + ": " + "type: "
+ // + cs.getType() );
+ switch (cs.getType()) {
+ case ColorSpace.TYPE_CMYK:
+ return "TYPE_CMYK";
+ case ColorSpace.TYPE_RGB:
+ return "TYPE_RGB";
+
+ case ColorSpace.CS_sRGB:
+ return "CS_sRGB";
+ case ColorSpace.CS_GRAY:
+ return "CS_GRAY";
+ case ColorSpace.CS_CIEXYZ:
+ return "CS_CIEXYZ";
+ case ColorSpace.CS_LINEAR_RGB:
+ return "CS_LINEAR_RGB";
+ case ColorSpace.CS_PYCC:
+ return "CS_PYCC";
}
return "unknown";
}
- public void dumpColorSpace(String prefix, ColorSpace cs)
- {
+ public void dumpColorSpace(String prefix, ColorSpace cs) {
System.out.println(prefix + ": " + "type: " + cs.getType() + " ("
+ colorSpaceTypeToName(cs) + ")");
- if (!(cs instanceof ICC_ColorSpace))
- {
+ if (!(cs instanceof ICC_ColorSpace)) {
System.out.println(prefix + ": " + "Unknown ColorSpace: "
+ cs.getClass().getName());
return;
@@ -75,32 +70,27 @@ public class ImageDump
info.dump(prefix);
}
- public void dump(BufferedImage src)
- {
+ public void dump(BufferedImage src) {
dump("", src);
}
- public void dump(String prefix, BufferedImage src)
- {
+ public void dump(String prefix, BufferedImage src) {
System.out.println(prefix + ": " + "dump");
dumpColorSpace(prefix, src.getColorModel().getColorSpace());
dumpBIProps(prefix, src);
}
- public void dumpBIProps(String prefix, BufferedImage src)
- {
+ public void dumpBIProps(String prefix, BufferedImage src) {
String keys[] = src.getPropertyNames();
- if (keys == null)
- {
+ if (keys == null) {
System.out.println(prefix + ": no props");
return;
}
- for (int i = 0; i < keys.length; i++)
- {
+ for (int i = 0; i < keys.length; i++) {
String key = keys[i];
System.out.println(prefix + ": " + key + ": "
+ src.getProperty(key));
}
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageFormat.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageFormat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageFormat.java Sat May 26 15:35:04 2012
@@ -16,29 +16,25 @@
*/
package org.apache.commons.imaging;
-public class ImageFormat
-{
+public class ImageFormat {
public final String name;
public final String extension;
public final boolean actual;
- private ImageFormat(String name, boolean actual)
- {
+ private ImageFormat(String name, boolean actual) {
this.name = name;
this.extension = name;
this.actual = actual;
}
- private ImageFormat(String name)
- {
+ private ImageFormat(String name) {
this.name = name;
this.extension = name;
actual = true;
}
@Override
- public boolean equals(Object o)
- {
+ public boolean equals(Object o) {
if (!(o instanceof ImageFormat))
return false;
@@ -49,14 +45,12 @@ public class ImageFormat
}
@Override
- public String toString()
- {
+ public String toString() {
return "{" + name + ": " + extension + "}";
}
@Override
- public int hashCode()
- {
+ public int hashCode() {
return name.hashCode();
}
@@ -74,7 +68,8 @@ public class ImageFormat
public static final ImageFormat IMAGE_FORMAT_PPM = new ImageFormat("PPM");
public static final ImageFormat IMAGE_FORMAT_PNM = new ImageFormat("PNM");
public static final ImageFormat IMAGE_FORMAT_TGA = new ImageFormat("TGA");
- public static final ImageFormat IMAGE_FORMAT_JBIG2 = new ImageFormat("JBig2");
+ public static final ImageFormat IMAGE_FORMAT_JBIG2 = new ImageFormat(
+ "JBig2");
public static final ImageFormat IMAGE_FORMAT_ICNS = new ImageFormat("ICNS");
public static final ImageFormat IMAGE_FORMAT_WBMP = new ImageFormat("WBMP");
public static final ImageFormat IMAGE_FORMAT_PCX = new ImageFormat("PCX");
@@ -83,20 +78,16 @@ public class ImageFormat
public static final ImageFormat IMAGE_FORMAT_XPM = new ImageFormat("XPM");
public static final ImageFormat IMAGE_FORMAT_RGBE = new ImageFormat("RGBE");
-
- public static final ImageFormat[] getAllFormats()
- {
- ImageFormat result[] = {
- IMAGE_FORMAT_UNKNOWN, IMAGE_FORMAT_PNG, IMAGE_FORMAT_GIF,
- IMAGE_FORMAT_TIFF, IMAGE_FORMAT_JPEG, IMAGE_FORMAT_BMP,
- IMAGE_FORMAT_PSD, IMAGE_FORMAT_PBM, IMAGE_FORMAT_PGM,
- IMAGE_FORMAT_PPM, IMAGE_FORMAT_PNM, IMAGE_FORMAT_TGA,
- IMAGE_FORMAT_JBIG2, IMAGE_FORMAT_ICNS, IMAGE_FORMAT_WBMP,
- IMAGE_FORMAT_PCX, IMAGE_FORMAT_DCX, IMAGE_FORMAT_XBM,
- IMAGE_FORMAT_XPM, IMAGE_FORMAT_RGBE
- };
+ public static final ImageFormat[] getAllFormats() {
+ ImageFormat result[] = { IMAGE_FORMAT_UNKNOWN, IMAGE_FORMAT_PNG,
+ IMAGE_FORMAT_GIF, IMAGE_FORMAT_TIFF, IMAGE_FORMAT_JPEG,
+ IMAGE_FORMAT_BMP, IMAGE_FORMAT_PSD, IMAGE_FORMAT_PBM,
+ IMAGE_FORMAT_PGM, IMAGE_FORMAT_PPM, IMAGE_FORMAT_PNM,
+ IMAGE_FORMAT_TGA, IMAGE_FORMAT_JBIG2, IMAGE_FORMAT_ICNS,
+ IMAGE_FORMAT_WBMP, IMAGE_FORMAT_PCX, IMAGE_FORMAT_DCX,
+ IMAGE_FORMAT_XBM, IMAGE_FORMAT_XPM, IMAGE_FORMAT_RGBE };
return result;
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageInfo.java Sat May 26 15:35:04 2012
@@ -25,8 +25,7 @@ import java.util.List;
* ImageInfo represents a collection of basic properties of an image, such as
* width, height, format, bit depth, etc.
*/
-public class ImageInfo
-{
+public class ImageInfo {
private final String formatDetails; // ie version
private final int bitsPerPixel;
@@ -77,8 +76,7 @@ public class ImageInfo
int physicalHeightDpi, float physicalHeightInch,
int physicalWidthDpi, float physicalWidthInch, int width,
boolean isProgressive, boolean isTransparent, boolean usesPalette,
- int colorType, String compressionAlgorithm)
- {
+ int colorType, String compressionAlgorithm) {
this.formatDetails = formatDetails;
this.bitsPerPixel = bitsPerPixel;
@@ -107,59 +105,55 @@ public class ImageInfo
/**
* Returns the bits per pixel of the image data.
*/
- public int getBitsPerPixel()
- {
+ public int getBitsPerPixel() {
return bitsPerPixel;
}
/**
- * Returns a list of comments from the image file. <p/> This is mostly
- * obsolete.
+ * Returns a list of comments from the image file.
+ * <p/>
+ * This is mostly obsolete.
*/
- public List<String> getComments()
- {
+ public List<String> getComments() {
return new ArrayList<String>(comments);
}
/**
- * Returns the image file format, ie. ImageFormat.IMAGE_FORMAT_PNG. <p/>
+ * Returns the image file format, ie. ImageFormat.IMAGE_FORMAT_PNG.
+ * <p/>
* Returns ImageFormat.IMAGE_FORMAT_UNKNOWN if format is unknown.
- *
+ *
* @return A constant defined in ImageFormat.
* @see ImageFormat
*/
- public ImageFormat getFormat()
- {
+ public ImageFormat getFormat() {
return format;
}
/**
* Returns a string with the name of the image file format.
- *
+ *
* @see #getFormat()
*/
- public String getFormatName()
- {
+ public String getFormatName() {
return formatName;
}
/**
* Returns the height of the image in pixels.
- *
+ *
* @see #getWidth()
*/
- public int getHeight()
- {
+ public int getHeight() {
return height;
}
/**
* Returns the MIME type of the image.
- *
+ *
* @see #getFormat()
*/
- public String getMimeType()
- {
+ public String getMimeType() {
return mimeType;
}
@@ -169,8 +163,7 @@ public class ImageInfo
* Applies mostly to GIF and TIFF; reading PSD/Photoshop layers is not
* supported, and Jpeg/JFIF EXIF thumbnails are not included in this count.
*/
- public int getNumberOfImages()
- {
+ public int getNumberOfImages() {
return numberOfImages;
}
@@ -180,11 +173,10 @@ public class ImageInfo
* Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg
* (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant:
* 72).
- *
+ *
* @return returns -1 if not present.
*/
- public int getPhysicalHeightDpi()
- {
+ public int getPhysicalHeightDpi() {
return physicalHeightDpi;
}
@@ -194,11 +186,10 @@ public class ImageInfo
* Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg
* (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant:
* 72).
- *
+ *
* @return returns -1 if not present.
*/
- public float getPhysicalHeightInch()
- {
+ public float getPhysicalHeightInch() {
return physicalHeightInch;
}
@@ -208,11 +199,10 @@ public class ImageInfo
* Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg
* (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant:
* 72).
- *
+ *
* @return returns -1 if not present.
*/
- public int getPhysicalWidthDpi()
- {
+ public int getPhysicalWidthDpi() {
return physicalWidthDpi;
}
@@ -222,52 +212,46 @@ public class ImageInfo
* Applies to TIFF (optional), BMP (always), GIF (constant: 72), Jpeg
* (optional), PNG (optional), PNM (constant: 72), PSD/Photoshop (constant:
* 72).
- *
+ *
* @return returns -1 if not present.
*/
- public float getPhysicalWidthInch()
- {
+ public float getPhysicalWidthInch() {
return physicalWidthInch;
}
/**
* Returns the width of the image in pixels.
- *
+ *
* @see #getHeight()
*/
- public int getWidth()
- {
+ public int getWidth() {
return width;
}
/**
* Returns true if the image is progressive or interlaced.
*/
- public boolean isProgressive()
- {
+ public boolean isProgressive() {
return isProgressive;
}
/**
* Returns the color type of the image, as a constant (ie.
* ImageFormat.COLOR_TYPE_CMYK).
- *
+ *
* @see #getColorTypeDescription()
*/
- public int getColorType()
- {
+ public int getColorType() {
return colorType;
}
/**
* Returns a description of the color type of the image.
- *
+ *
* @see #getColorType()
*/
- public String getColorTypeDescription()
- {
- switch (colorType)
- {
+ public String getColorTypeDescription() {
+ switch (colorType) {
case COLOR_TYPE_BW:
return "Black and White";
case COLOR_TYPE_GRAYSCALE:
@@ -287,16 +271,13 @@ public class ImageInfo
}
- public void dump()
- {
+ public void dump() {
System.out.print(toString());
}
@Override
- public String toString()
- {
- try
- {
+ public String toString() {
+ try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -304,20 +285,17 @@ public class ImageInfo
pw.flush();
return sw.toString();
- } catch (Exception e)
- {
+ } catch (Exception e) {
return "Image Data: Error";
}
}
- public void toString(PrintWriter pw, String prefix)
- {
+ public void toString(PrintWriter pw, String prefix) {
pw.println("Format Details: " + formatDetails);
pw.println("Bits Per Pixel: " + bitsPerPixel);
pw.println("Comments: " + comments.size());
- for (int i = 0; i < comments.size(); i++)
- {
+ for (int i = 0; i < comments.size(); i++) {
String s = comments.get(i);
pw.println("\t" + i + ": '" + s + "'");
@@ -371,4 +349,4 @@ public class ImageInfo
return compressionAlgorithm;
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageParser.java Sat May 26 15:35:04 2012
@@ -52,11 +52,9 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.util.Debug;
public abstract class ImageParser extends BinaryFileParser implements
- ImagingConstants
-{
+ ImagingConstants {
- public static final ImageParser[] getAllImageParsers()
- {
+ public static final ImageParser[] getAllImageParsers() {
ImageParser result[] = { new JpegImageParser(), new TiffImageParser(),
new PngImageParser(), new BmpImageParser(),
new GifImageParser(), new PsdImageParser(),
@@ -73,8 +71,7 @@ public abstract class ImageParser extend
}
public final IImageMetadata getMetadata(ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getMetadata(byteSource, null);
}
@@ -82,26 +79,22 @@ public abstract class ImageParser extend
throws ImageReadException, IOException;
public final IImageMetadata getMetadata(byte bytes[])
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getMetadata(bytes, null);
}
public final IImageMetadata getMetadata(byte bytes[], Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getMetadata(new ByteSourceArray(bytes), params);
}
public final IImageMetadata getMetadata(File file)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getMetadata(file, null);
}
public final IImageMetadata getMetadata(File file, Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (debug)
System.out.println(getName() + ".getMetadata" + ": "
+ file.getName());
@@ -116,20 +109,17 @@ public abstract class ImageParser extend
throws ImageReadException, IOException;
public final ImageInfo getImageInfo(ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getImageInfo(byteSource, null);
}
public final ImageInfo getImageInfo(byte bytes[], Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getImageInfo(new ByteSourceArray(bytes), params);
}
public final ImageInfo getImageInfo(File file, Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -137,24 +127,23 @@ public abstract class ImageParser extend
}
/**
- * @throws ImageReadException may be thrown by sub-classes
- * @throws IOException may be thrown by sub-classes
+ * @throws ImageReadException
+ * may be thrown by sub-classes
+ * @throws IOException
+ * may be thrown by sub-classes
*/
public FormatCompliance getFormatCompliance(ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return null;
}
public final FormatCompliance getFormatCompliance(byte bytes[])
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getFormatCompliance(new ByteSourceArray(bytes));
}
public final FormatCompliance getFormatCompliance(File file)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -162,8 +151,7 @@ public abstract class ImageParser extend
}
public List<BufferedImage> getAllBufferedImages(ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
BufferedImage bi = getBufferedImage(byteSource, null);
List<BufferedImage> result = new ArrayList<BufferedImage>();
@@ -174,14 +162,12 @@ public abstract class ImageParser extend
}
public final List<BufferedImage> getAllBufferedImages(byte bytes[])
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getAllBufferedImages(new ByteSourceArray(bytes));
}
public final List<BufferedImage> getAllBufferedImages(File file)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -233,14 +219,12 @@ public abstract class ImageParser extend
Map params) throws ImageReadException, IOException;
public final BufferedImage getBufferedImage(byte bytes[], Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getBufferedImage(new ByteSourceArray(bytes), params);
}
public final BufferedImage getBufferedImage(File file, Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -248,16 +232,14 @@ public abstract class ImageParser extend
}
/**
- * @throws IOException may be thrown by sub-classes
+ * @throws IOException
+ * may be thrown by sub-classes
*/
public void writeImage(BufferedImage src, OutputStream os, Map params)
- throws ImageWriteException, IOException
- {
- try
- {
+ throws ImageWriteException, IOException {
+ try {
os.close(); // we are obligated to close stream.
- } catch (Exception e)
- {
+ } catch (Exception e) {
Debug.debug(e);
}
@@ -266,27 +248,23 @@ public abstract class ImageParser extend
}
public final Dimension getImageSize(byte bytes[])
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getImageSize(bytes, null);
}
public final Dimension getImageSize(byte bytes[], Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getImageSize(new ByteSourceArray(bytes), params);
}
public final Dimension getImageSize(File file) throws ImageReadException,
- IOException
- {
+ IOException {
return getImageSize(file, null);
}
public final Dimension getImageSize(File file, Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -301,26 +279,22 @@ public abstract class ImageParser extend
throws ImageReadException, IOException;
public final byte[] getICCProfileBytes(byte bytes[])
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getICCProfileBytes(bytes, null);
}
public final byte[] getICCProfileBytes(byte bytes[], Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getICCProfileBytes(new ByteSourceArray(bytes), params);
}
public final byte[] getICCProfileBytes(File file)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return getICCProfileBytes(file, null);
}
public final byte[] getICCProfileBytes(File file, Map params)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
if (!canAcceptExtension(file))
return null;
@@ -334,14 +308,12 @@ public abstract class ImageParser extend
throws ImageReadException, IOException;
public final String dumpImageFile(byte bytes[]) throws ImageReadException,
- IOException
- {
+ IOException {
return dumpImageFile(new ByteSourceArray(bytes));
}
public final String dumpImageFile(File file) throws ImageReadException,
- IOException
- {
+ IOException {
if (!canAcceptExtension(file))
return null;
@@ -352,8 +324,7 @@ public abstract class ImageParser extend
}
public final String dumpImageFile(ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@@ -365,12 +336,13 @@ public abstract class ImageParser extend
}
/**
- * @throws ImageReadException may be thrown by sub-classes
- * @throws IOException may be thrown by sub-classes
+ * @throws ImageReadException
+ * may be thrown by sub-classes
+ * @throws IOException
+ * may be thrown by sub-classes
*/
public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
- throws ImageReadException, IOException
- {
+ throws ImageReadException, IOException {
return false;
}
@@ -384,8 +356,7 @@ public abstract class ImageParser extend
protected abstract ImageFormat[] getAcceptedTypes();
- public boolean canAcceptType(ImageFormat type)
- {
+ public boolean canAcceptType(ImageFormat type) {
ImageFormat types[] = getAcceptedTypes();
for (int i = 0; i < types.length; i++)
@@ -394,20 +365,17 @@ public abstract class ImageParser extend
return false;
}
- protected final boolean canAcceptExtension(File file)
- {
+ protected final boolean canAcceptExtension(File file) {
return canAcceptExtension(file.getName());
}
- protected final boolean canAcceptExtension(String filename)
- {
+ protected final boolean canAcceptExtension(String filename) {
String exts[] = getAcceptedExtensions();
if (exts == null)
return true;
int index = filename.lastIndexOf('.');
- if (index >= 0)
- {
+ if (index >= 0) {
String ext = filename.substring(index);
ext = ext.toLowerCase();
@@ -418,8 +386,7 @@ public abstract class ImageParser extend
return false;
}
- protected IBufferedImageFactory getBufferedImageFactory(Map params)
- {
+ protected IBufferedImageFactory getBufferedImageFactory(Map params) {
if (params == null)
return new SimpleBufferedImageFactory();
@@ -432,10 +399,9 @@ public abstract class ImageParser extend
return new SimpleBufferedImageFactory();
}
- public static final boolean isStrict(Map params)
- {
+ public static final boolean isStrict(Map params) {
if (params == null || !params.containsKey(PARAM_KEY_STRICT))
return false;
return ((Boolean) params.get(PARAM_KEY_STRICT)).booleanValue();
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageReadException.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageReadException.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageReadException.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageReadException.java Sat May 26 15:35:04 2012
@@ -16,17 +16,14 @@
*/
package org.apache.commons.imaging;
-public class ImageReadException extends ImagingException
-{
+public class ImageReadException extends ImagingException {
private static final long serialVersionUID = -1L;
- public ImageReadException(String s)
- {
+ public ImageReadException(String s) {
super(s);
}
- public ImageReadException(String s, Exception e)
- {
+ public ImageReadException(String s, Exception e) {
super(s, e);
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImageWriteException.java Sat May 26 15:35:04 2012
@@ -16,17 +16,14 @@
*/
package org.apache.commons.imaging;
-public class ImageWriteException extends ImagingException
-{
+public class ImageWriteException extends ImagingException {
static final long serialVersionUID = -1L;
- public ImageWriteException(String s)
- {
+ public ImageWriteException(String s) {
super(s);
}
- public ImageWriteException(String s, Exception e)
- {
+ public ImageWriteException(String s, Exception e) {
super(s, e);
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/Imaging.java Sat May 26 15:35:04 2012
@@ -49,8 +49,9 @@ import org.apache.commons.imaging.util.D
* <p>
* See the source of the SampleUsage class and other classes in the
* org.apache.commons.imaging.examples package for examples.
- *
- * @see <a href="https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java">org.apache.commons.imaging.examples.SampleUsage</a>
+ *
+ * @see <a
+ * href="https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/SampleUsage.java">org.apache.commons.imaging.examples.SampleUsage</a>
*/
public abstract class Imaging implements ImagingConstants {
@@ -61,7 +62,7 @@ public abstract class Imaging implements
* Returns true if the file has a file extension associated with a file
* format, such as .jpg or .gif.
* <p>
- *
+ *
* @param file
* File which may contain an image.
* @return true if the file has an image format file extension.
@@ -79,7 +80,7 @@ public abstract class Imaging implements
* Returns true if the filename has a file extension associated with a file
* format, such as .jpg or .gif.
* <p>
- *
+ *
* @param filename
* String representing name of file which may contain an image.
* @return true if the filename has an image format file extension.
@@ -106,7 +107,7 @@ public abstract class Imaging implements
* Tries to guess what the image type (if any) of data based on the file's
* "magic numbers," the first bytes of the data.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns
@@ -122,7 +123,7 @@ public abstract class Imaging implements
* Tries to guess what the image type (if any) of a file based on the file's
* "magic numbers," the first bytes of the file.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns
@@ -247,7 +248,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return An instance of ICC_Profile or null if the image contains no ICC
@@ -262,7 +263,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -279,7 +280,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -296,7 +297,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -315,7 +316,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return An instance of ICC_Profile or null if the image contains no ICC
@@ -330,7 +331,7 @@ public abstract class Imaging implements
* Extracts an ICC Profile (if present) from JPEG, PNG, PSD (Photoshop) and
* TIFF images.
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -367,7 +368,7 @@ public abstract class Imaging implements
* To parse the result use IccProfileParser or
* ICC_Profile.getInstance(bytes).
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return A byte array.
@@ -386,7 +387,7 @@ public abstract class Imaging implements
* To parse the result use IccProfileParser or
* ICC_Profile.getInstance(bytes).
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -407,7 +408,7 @@ public abstract class Imaging implements
* To parse the result use IccProfileParser or
* ICC_Profile.getInstance(bytes).
* <p>
- *
+ *
* @param file
* File containing image data.
* @return A byte array.
@@ -426,7 +427,7 @@ public abstract class Imaging implements
* To parse the result use IccProfileParser or
* ICC_Profile.getInstance(bytes).
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -455,7 +456,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param filename
* String.
* @param bytes
@@ -478,7 +479,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param filename
* String.
* @param bytes
@@ -499,7 +500,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -520,7 +521,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -543,7 +544,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return An instance of ImageInfo.
@@ -562,7 +563,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -583,7 +584,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -604,7 +605,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image metadata."
* <p>
- *
+ *
* @param file
* File containing image data.
* @return An instance of ImageInfo.
@@ -657,7 +658,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -672,7 +673,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -689,7 +690,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return The width and height of the image.
@@ -702,7 +703,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -717,7 +718,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image file.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return The width and height of the image.
@@ -730,7 +731,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image file.
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -752,7 +753,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -767,7 +768,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -784,7 +785,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return Xmp Xml as String, if present. Otherwise, returns null.
@@ -797,7 +798,7 @@ public abstract class Imaging implements
/**
* Determines the width and height of an image.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -812,7 +813,7 @@ public abstract class Imaging implements
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return Xmp Xml as String, if present. Otherwise, returns null.
@@ -825,7 +826,7 @@ public abstract class Imaging implements
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -840,7 +841,7 @@ public abstract class Imaging implements
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param byteSource
* File containing image data.
* @param params
@@ -866,7 +867,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return An instance of IImageMetadata.
@@ -889,7 +890,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -914,7 +915,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -939,7 +940,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
@@ -966,7 +967,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param file
* File containing image data.
* @return An instance of IImageMetadata.
@@ -989,7 +990,7 @@ public abstract class Imaging implements
* <p>
* Not to be confused with "image info."
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -1014,7 +1015,7 @@ public abstract class Imaging implements
* <p>
* Useful for exploring format-specific details of image files.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return A description of the image file's structure.
@@ -1029,7 +1030,7 @@ public abstract class Imaging implements
* <p>
* Useful for exploring format-specific details of image files.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return A description of the image file's structure.
@@ -1069,15 +1070,15 @@ public abstract class Imaging implements
* Useful for image formats such as GIF and ICO in which a single file may
* contain multiple images.
* <p>
- *
+ *
* @param is
* InputStream from which to read image data.
* @param filename
* Filename associated with image data (optional).
* @return A vector of BufferedImages.
*/
- public static List<BufferedImage> getAllBufferedImages(InputStream is, String filename)
- throws ImageReadException, IOException {
+ public static List<BufferedImage> getAllBufferedImages(InputStream is,
+ String filename) throws ImageReadException, IOException {
return getAllBufferedImages(new ByteSourceInputStream(is, filename));
}
@@ -1087,7 +1088,7 @@ public abstract class Imaging implements
* Useful for image formats such as GIF and ICO in which a single file may
* contain multiple images.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return A vector of BufferedImages.
@@ -1103,7 +1104,7 @@ public abstract class Imaging implements
* Useful for image formats such as GIF and ICO in which a single file may
* contain multiple images.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return A vector of BufferedImages.
@@ -1113,8 +1114,8 @@ public abstract class Imaging implements
return getAllBufferedImages(new ByteSourceFile(file));
}
- private static List<BufferedImage> getAllBufferedImages(ByteSource byteSource)
- throws ImageReadException, IOException {
+ private static List<BufferedImage> getAllBufferedImages(
+ ByteSource byteSource) throws ImageReadException, IOException {
ImageParser imageParser = getImageParser(byteSource);
return imageParser.getAllBufferedImages(byteSource);
@@ -1156,7 +1157,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param is
* InputStream to read image data from.
* @return A BufferedImage.
@@ -1178,7 +1179,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param is
* InputStream to read image data from.
* @param params
@@ -1205,7 +1206,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @return A BufferedImage.
@@ -1227,7 +1228,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param bytes
* Byte array containing an image file.
* @param params
@@ -1251,7 +1252,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param file
* File containing image data.
* @return A BufferedImage.
@@ -1273,7 +1274,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param file
* File containing image data.
* @param params
@@ -1306,7 +1307,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param src
* The BufferedImage to be written.
* @param file
@@ -1348,7 +1349,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param src
* The BufferedImage to be written.
* @param format
@@ -1379,7 +1380,7 @@ public abstract class Imaging implements
* and cannot be written. All other formats (PNG, GIF, TIFF, BMP, etc.) are
* fully supported.
* <p>
- *
+ *
* @param src
* The BufferedImage to be written.
* @param os
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingConstants.java Sat May 26 15:35:04 2012
@@ -20,8 +20,7 @@ import java.io.InputStream;
import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
-public interface ImagingConstants
-{
+public interface ImagingConstants {
/**
* Parameter key. Applies to read and write operations.
* <p>
@@ -38,7 +37,7 @@ public interface ImagingConstants
* <p>
* Valid values: filename as string
* <p>
- *
+ *
* @see InputStream
*/
public static final String PARAM_KEY_FILENAME = "FILENAME";
@@ -49,7 +48,7 @@ public interface ImagingConstants
* Valid values: Any format defined in ImageFormat, such as
* ImageFormat.IMAGE_FORMAT_PNG.
* <p>
- *
+ *
* @see ImageFormat
*/
public static final String PARAM_KEY_FORMAT = "FORMAT";
@@ -65,7 +64,7 @@ public interface ImagingConstants
* TiffConstants.TIFF_COMPRESSION_LZW,
* TiffConstants.TIFF_COMPRESSION_PACKBITS.
* <p>
- *
+ *
* @see TiffConstants
*/
public static final String PARAM_KEY_COMPRESSION = "COMPRESSION";
@@ -79,7 +78,7 @@ public interface ImagingConstants
* <p>
* Valid values: Boolean.TRUE and Boolean.FALSE.
* <p>
- *
+ *
* @see TiffConstants
*/
public static final String PARAM_KEY_READ_THUMBNAILS = "READ_THUMBNAILS";
@@ -91,14 +90,14 @@ public interface ImagingConstants
* Valid values: Boolean.TRUE and Boolean.FALSE. Default value:
* Boolean.FALSE.
* <p>
- *
+ *
* @see TiffConstants
*/
public static final String PARAM_KEY_STRICT = "STRICT";
/**
* Parameter key.
- *
+ *
* Only used when writing images.
* <p>
* Valid values: TiffOutputSet to write into the image's EXIF metadata.
@@ -108,17 +107,17 @@ public interface ImagingConstants
/**
* Parameter key.
- *
+ *
* Only used when writing images.
* <p>
* Valid values: String of XMP XML.
* <p>
*/
public static final String PARAM_KEY_XMP_XML = "XMP_XML";
-
+
/**
- * Parameter key. Used in write operations to indicate the desired
- * pixel density (DPI), and/or aspect ratio.
+ * Parameter key. Used in write operations to indicate the desired pixel
+ * density (DPI), and/or aspect ratio.
* <p>
* Valid values: PixelDensity
*/
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingException.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingException.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingException.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/ImagingException.java Sat May 26 15:35:04 2012
@@ -16,17 +16,14 @@
*/
package org.apache.commons.imaging;
-public class ImagingException extends Exception
-{
+public class ImagingException extends Exception {
private static final long serialVersionUID = -1L;
- public ImagingException(String s)
- {
+ public ImagingException(String s) {
super(s);
}
- public ImagingException(String s, Exception e)
- {
+ public ImagingException(String s, Exception e) {
super(s, e);
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/PixelDensity.java Sat May 26 15:35:04 2012
@@ -19,55 +19,56 @@ package org.apache.commons.imaging;
public class PixelDensity {
private double horizontalDensity;
private double verticalDensity;
- /// One-tenth of a millimetre units.
+ // / One-tenth of a millimetre units.
private int unitLength;
-
- private PixelDensity(double horizontalDensity, double verticalDensity, int unitLength) {
+
+ private PixelDensity(double horizontalDensity, double verticalDensity,
+ int unitLength) {
this.horizontalDensity = horizontalDensity;
this.verticalDensity = verticalDensity;
this.unitLength = unitLength;
}
-
+
public static PixelDensity createUnitless(double x, double y) {
return new PixelDensity(x, y, 0);
}
-
+
public static PixelDensity createFromPixelsPerInch(double x, double y) {
return new PixelDensity(x, y, 254);
}
-
+
public static PixelDensity createFromPixelsPerMetre(double x, double y) {
return new PixelDensity(x, y, 10000);
}
-
+
public static PixelDensity createFromPixelsPerCentimetre(double x, double y) {
return new PixelDensity(x, y, 100);
}
-
+
public boolean isUnitless() {
return unitLength == 0;
}
-
+
public boolean isInInches() {
return unitLength == 254;
}
-
+
public boolean isInCentimetres() {
return unitLength == 100;
}
-
+
public boolean isInMetres() {
return unitLength == 10000;
}
-
+
public double getRawHorizontalDensity() {
return horizontalDensity;
}
-
+
public double getRawVerticalDensity() {
return verticalDensity;
}
-
+
public double horizontalDensityInches() {
if (isInInches()) {
return horizontalDensity;
@@ -75,15 +76,15 @@ public class PixelDensity {
return horizontalDensity * 254 / unitLength;
}
}
-
+
public double verticalDensityInches() {
if (isInInches()) {
return verticalDensity;
} else {
- return verticalDensity * 254 / unitLength;
+ return verticalDensity * 254 / unitLength;
}
}
-
+
public double horizontalDensityMetres() {
if (isInMetres()) {
return horizontalDensity;
@@ -91,7 +92,7 @@ public class PixelDensity {
return horizontalDensity * 10000 / unitLength;
}
}
-
+
public double verticalDensityMetres() {
if (isInMetres()) {
return verticalDensity;
@@ -99,7 +100,7 @@ public class PixelDensity {
return verticalDensity * 10000 / unitLength;
}
}
-
+
public double horizontalDensityCentimetres() {
if (isInCentimetres()) {
return horizontalDensity;
@@ -107,7 +108,7 @@ public class PixelDensity {
return horizontalDensity * 100 / unitLength;
}
}
-
+
public double verticalDensityCentimetres() {
if (isInCentimetres()) {
return verticalDensity;
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLab.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
*/
package org.apache.commons.imaging.color;
-public final class ColorCieLab
-{
+public final class ColorCieLab {
public final double L, a, b;
- public ColorCieLab(double l, double a, double b)
- {
+ public ColorCieLab(double l, double a, double b) {
L = l;
this.a = a;
this.b = b;
}
@Override
- public final String toString()
- {
+ public final String toString() {
return "{L: " + L + ", a: " + a + ", b: " + b + "}";
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLch.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
*/
package org.apache.commons.imaging.color;
-public final class ColorCieLch
-{
+public final class ColorCieLch {
public final double L, C, H;
- public ColorCieLch(double l, double C, double H)
- {
+ public ColorCieLch(double l, double C, double H) {
L = l;
this.C = C;
this.H = H;
}
@Override
- public String toString()
- {
+ public String toString() {
return "{L: " + L + ", C: " + C + ", H: " + H + "}";
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCieLuv.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
*/
package org.apache.commons.imaging.color;
-public final class ColorCieLuv
-{
+public final class ColorCieLuv {
public final double L, u, v;
- public ColorCieLuv(double l, double u, double v)
- {
+ public ColorCieLuv(double l, double u, double v) {
L = l;
this.u = u;
this.v = v;
}
@Override
- public String toString()
- {
+ public String toString() {
return "{L: " + L + ", u: " + u + ", v: " + v + "}";
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmy.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmy.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmy.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmy.java Sat May 26 15:35:04 2012
@@ -16,20 +16,17 @@
*/
package org.apache.commons.imaging.color;
-public final class ColorCmy
-{
+public final class ColorCmy {
public final double C, M, Y;
- public ColorCmy(double C, double M, double Y)
- {
+ public ColorCmy(double C, double M, double Y) {
this.C = C;
this.M = M;
this.Y = Y;
}
@Override
- public final String toString()
- {
+ public final String toString() {
return "{C: " + C + ", M: " + M + ", Y: " + Y + "}";
}
-}
\ No newline at end of file
+}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java?rev=1342914&r1=1342913&r2=1342914&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/color/ColorCmyk.java Sat May 26 15:35:04 2012
@@ -16,12 +16,10 @@
*/
package org.apache.commons.imaging.color;
-public final class ColorCmyk
-{
+public final class ColorCmyk {
public final double C, M, Y, K;
- public ColorCmyk(double C, double M, double Y, double K)
- {
+ public ColorCmyk(double C, double M, double Y, double K) {
this.C = C;
this.M = M;
this.Y = Y;
@@ -29,8 +27,7 @@ public final class ColorCmyk
}
@Override
- public final String toString()
- {
+ public final String toString() {
return "{C: " + C + ", M: " + M + ", Y: " + Y + ", K: " + K + "}";
}
-}
\ No newline at end of file
+}