commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1539242 [2/2] - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: formats/jpeg/ formats/jpeg/decoder/ formats/jpeg/exif/ formats/jpeg/iptc/ formats/jpeg/segments/ formats/jpeg/xmp/ formats/pcx/ formats/png/ formats...
Date Wed, 06 Nov 2013 05:01:05 GMT
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=1539242&r1=1539241&r2=1539242&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  6 05:01:04 2013
@@ -26,6 +26,7 @@ import java.util.Map;
 import java.util.zip.DeflaterOutputStream;
 
 import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.ImagingConstants;
 import org.apache.commons.imaging.PixelDensity;
 import org.apache.commons.imaging.common.ZLibUtils;
 import org.apache.commons.imaging.palette.Palette;
@@ -35,7 +36,7 @@ import org.apache.commons.imaging.util.D
 import org.apache.commons.imaging.util.ParamMap;
 import org.apache.commons.imaging.util.UnicodeUtils;
 
-public class PngWriter implements PngConstants {
+public class PngWriter {
     private final boolean verbose;
 
     public PngWriter(final boolean verbose) {
@@ -43,7 +44,7 @@ public class PngWriter implements PngCon
     }
 
     public PngWriter(final Map<String,Object> params) {
-        this.verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
+        this.verbose = ParamMap.getParamBoolean(params, ImagingConstants.PARAM_KEY_VERBOSE,
                 false);
     }
 
@@ -124,7 +125,7 @@ public class PngWriter implements PngCon
 
         // Debug.debug("baos", baos.toByteArray());
 
-        writeChunk(os, IHDR_CHUNK_TYPE.toByteArray(), baos.toByteArray());
+        writeChunk(os, PngConstants.IHDR_CHUNK_TYPE.toByteArray(), baos.toByteArray());
     }
 
     private void writeChunkiTXt(final OutputStream os, final PngText.Itxt text)
@@ -146,7 +147,7 @@ public class PngWriter implements PngCon
         baos.write(0);
 
         baos.write(1); // compressed flag, true
-        baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method
+        baos.write(PngConstants.COMPRESSION_DEFLATE_INFLATE); // compression method
 
         // language tag
         baos.write(text.languageTag.getBytes("ISO-8859-1"));
@@ -158,7 +159,7 @@ public class PngWriter implements PngCon
 
         baos.write(new ZLibUtils().deflate(text.text.getBytes("utf-8")));
 
-        writeChunk(os, iTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
+        writeChunk(os, PngConstants.iTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
     }
 
     private void writeChunkzTXt(final OutputStream os, final PngText.Ztxt text)
@@ -184,7 +185,7 @@ public class PngWriter implements PngCon
         // text
         baos.write(new ZLibUtils().deflate(text.text.getBytes("ISO-8859-1")));
 
-        writeChunk(os, zTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
+        writeChunk(os, PngConstants.zTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
     }
 
     private void writeChunktEXt(final OutputStream os, final PngText.Text text)
@@ -207,7 +208,7 @@ public class PngWriter implements PngCon
         // text
         baos.write(text.text.getBytes("ISO-8859-1"));
 
-        writeChunk(os, tEXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
+        writeChunk(os, PngConstants.tEXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
     }
 
     private void writeChunkXmpiTXt(final OutputStream os, final String xmpXml)
@@ -216,21 +217,21 @@ public class PngWriter implements PngCon
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         // keyword
-        baos.write(XMP_KEYWORD.getBytes("ISO-8859-1"));
+        baos.write(PngConstants.XMP_KEYWORD.getBytes("ISO-8859-1"));
         baos.write(0);
 
         baos.write(1); // compressed flag, true
-        baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method
+        baos.write(PngConstants.COMPRESSION_DEFLATE_INFLATE); // compression method
 
         baos.write(0); // language tag (ignore). TODO
 
         // translated keyword
-        baos.write(XMP_KEYWORD.getBytes("utf-8"));
+        baos.write(PngConstants.XMP_KEYWORD.getBytes("utf-8"));
         baos.write(0);
 
         baos.write(new ZLibUtils().deflate(xmpXml.getBytes("utf-8")));
 
-        writeChunk(os, iTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
+        writeChunk(os, PngConstants.iTXt_CHUNK_TYPE.toByteArray(), baos.toByteArray());
     }
 
     private void writeChunkPLTE(final OutputStream os, final Palette palette)
@@ -248,7 +249,7 @@ public class PngWriter implements PngCon
             bytes[index + 2] = (byte) (0xff & (rgb >> 0));
         }
 
-        writeChunk(os, PLTE_CHUNK_TYPE.toByteArray(), bytes);
+        writeChunk(os, PngConstants.PLTE_CHUNK_TYPE.toByteArray(), bytes);
     }
 
     private void writeChunkTRNS(final OutputStream os, final Palette palette) throws IOException
{
@@ -258,16 +259,16 @@ public class PngWriter implements PngCon
             bytes[i] = (byte) (0xff & (palette.getEntry(i) >> 24));
         }
         
-        writeChunk(os, TRNS_CHUNK_TYPE.toByteArray(), bytes);
+        writeChunk(os, PngConstants.TRNS_CHUNK_TYPE.toByteArray(), bytes);
     }
 
     private void writeChunkIEND(final OutputStream os) throws IOException {
-        writeChunk(os, IEND_CHUNK_TYPE.toByteArray(), null);
+        writeChunk(os, PngConstants.IEND_CHUNK_TYPE.toByteArray(), null);
     }
 
     private void writeChunkIDAT(final OutputStream os, final byte bytes[])
             throws IOException {
-        writeChunk(os, IDAT_CHUNK_TYPE.toByteArray(), bytes);
+        writeChunk(os, PngConstants.IDAT_CHUNK_TYPE.toByteArray(), bytes);
     }
 
     private void writeChunkPHYS(final OutputStream os, final int xPPU, final int yPPU, final
byte units)
@@ -282,7 +283,7 @@ public class PngWriter implements PngCon
         bytes[6] = (byte) (0xff & (yPPU >> 8));
         bytes[7] = (byte) (0xff & (yPPU >> 0));
         bytes[8] = units;
-        writeChunk(os, IPHYS_CHUNK_TYPE.toByteArray(), bytes);
+        writeChunk(os, PngConstants.IPHYS_CHUNK_TYPE.toByteArray(), bytes);
     }
 
     private byte getColourType(final boolean hasAlpha, final boolean isGrayscale) {
@@ -291,17 +292,17 @@ public class PngWriter implements PngCon
         final boolean index = false; // charles
 
         if (index) {
-            result = COLOR_TYPE_INDEXED_COLOR;
+            result = PngConstants.COLOR_TYPE_INDEXED_COLOR;
         } else if (isGrayscale) {
             if (hasAlpha) {
-                result = COLOR_TYPE_GREYSCALE_WITH_ALPHA;
+                result = PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA;
             } else {
-                result = COLOR_TYPE_GREYSCALE;
+                result = PngConstants.COLOR_TYPE_GREYSCALE;
             }
         } else if (hasAlpha) {
-            result = COLOR_TYPE_TRUE_COLOR_WITH_ALPHA;
+            result = PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA;
         } else {
-            result = COLOR_TYPE_TRUE_COLOR;
+            result = PngConstants.COLOR_TYPE_TRUE_COLOR;
         }
 
         return result;
@@ -310,7 +311,7 @@ public class PngWriter implements PngCon
     private byte getBitDepth(final byte colorType, final Map<String,Object> params)
{
         byte result = 8;
 
-        final Object o = params.get(PARAM_KEY_PNG_BIT_DEPTH);
+        final Object o = params.get(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
         if (o != null && o instanceof Number) {
             final int value = ((Number) o).intValue();
             switch (value) {
@@ -325,14 +326,14 @@ public class PngWriter implements PngCon
                 result = 8;
             }
             switch (colorType) {
-            case COLOR_TYPE_GREYSCALE:
+            case PngConstants.COLOR_TYPE_GREYSCALE:
                 break;
-            case COLOR_TYPE_INDEXED_COLOR:
+            case PngConstants.COLOR_TYPE_INDEXED_COLOR:
                 result = (byte) Math.min(8, result);
                 break;
-            case COLOR_TYPE_GREYSCALE_WITH_ALPHA:
-            case COLOR_TYPE_TRUE_COLOR:
-            case COLOR_TYPE_TRUE_COLOR_WITH_ALPHA:
+            case PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA:
+            case PngConstants.COLOR_TYPE_TRUE_COLOR:
+            case PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA:
                 result = (byte) Math.max(8, result);
                 break;
             default:
@@ -410,31 +411,31 @@ public class PngWriter implements PngCon
         params = new HashMap<String,Object>(params);
 
         // clear format key.
-        if (params.containsKey(PARAM_KEY_FORMAT)) {
-            params.remove(PARAM_KEY_FORMAT);
+        if (params.containsKey(ImagingConstants.PARAM_KEY_FORMAT)) {
+            params.remove(ImagingConstants.PARAM_KEY_FORMAT);
         }
         // clear verbose key.
-        if (params.containsKey(PARAM_KEY_VERBOSE)) {
-            params.remove(PARAM_KEY_VERBOSE);
+        if (params.containsKey(ImagingConstants.PARAM_KEY_VERBOSE)) {
+            params.remove(ImagingConstants.PARAM_KEY_VERBOSE);
         }
 
         final Map<String,Object> rawParams = new HashMap<String,Object>(params);
-        if (params.containsKey(PARAM_KEY_PNG_FORCE_TRUE_COLOR)) {
-            params.remove(PARAM_KEY_PNG_FORCE_TRUE_COLOR);
+        if (params.containsKey(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR)) {
+            params.remove(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR);
         }
-        if (params.containsKey(PARAM_KEY_PNG_FORCE_INDEXED_COLOR)) {
-            params.remove(PARAM_KEY_PNG_FORCE_INDEXED_COLOR);
+        if (params.containsKey(PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR)) {
+            params.remove(PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR);
         }
-        if (params.containsKey(PARAM_KEY_PNG_BIT_DEPTH)) {
-            params.remove(PARAM_KEY_PNG_BIT_DEPTH);
+        if (params.containsKey(PngConstants.PARAM_KEY_PNG_BIT_DEPTH)) {
+            params.remove(PngConstants.PARAM_KEY_PNG_BIT_DEPTH);
         }
-        if (params.containsKey(PARAM_KEY_XMP_XML)) {
-            params.remove(PARAM_KEY_XMP_XML);
+        if (params.containsKey(ImagingConstants.PARAM_KEY_XMP_XML)) {
+            params.remove(ImagingConstants.PARAM_KEY_XMP_XML);
         }
-        if (params.containsKey(PARAM_KEY_PNG_TEXT_CHUNKS)) {
-            params.remove(PARAM_KEY_PNG_TEXT_CHUNKS);
+        if (params.containsKey(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS)) {
+            params.remove(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS);
         }
-        params.remove(PARAM_KEY_PIXEL_DENSITY);
+        params.remove(ImagingConstants.PARAM_KEY_PIXEL_DENSITY);
         if (params.size() > 0) {
             final Object firstKey = params.keySet().iterator().next();
             throw new ImageWriteException("Unknown parameter: " + firstKey);
@@ -458,18 +459,18 @@ public class PngWriter implements PngCon
         byte colorType;
         {
             final boolean forceIndexedColor = ParamMap.getParamBoolean(params,
-                    PARAM_KEY_PNG_FORCE_INDEXED_COLOR, false);
+                    PngConstants.PARAM_KEY_PNG_FORCE_INDEXED_COLOR, false);
             final boolean forceTrueColor = ParamMap.getParamBoolean(params,
-                    PARAM_KEY_PNG_FORCE_TRUE_COLOR, false);
+                    PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR, false);
 
             if (forceIndexedColor && forceTrueColor) {
                 throw new ImageWriteException(
                         "Params: Cannot force both indexed and true color modes");
             } else if (forceIndexedColor) {
-                colorType = COLOR_TYPE_INDEXED_COLOR;
+                colorType = PngConstants.COLOR_TYPE_INDEXED_COLOR;
             } else if (forceTrueColor) {
-                colorType = (byte) (hasAlpha ? COLOR_TYPE_TRUE_COLOR_WITH_ALPHA
-                        : COLOR_TYPE_TRUE_COLOR);
+                colorType = (byte) (hasAlpha ? PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA
+                        : PngConstants.COLOR_TYPE_TRUE_COLOR);
                 isGrayscale = false;
             } else {
                 colorType = getColourType(hasAlpha, isGrayscale);
@@ -485,7 +486,7 @@ public class PngWriter implements PngCon
         }
 
         int sampleDepth;
-        if (colorType == COLOR_TYPE_INDEXED_COLOR) {
+        if (colorType == PngConstants.COLOR_TYPE_INDEXED_COLOR) {
             sampleDepth = 8;
         } else {
             sampleDepth = bitDepth;
@@ -495,14 +496,14 @@ public class PngWriter implements PngCon
         }
 
         {
-            PNG_Signature.writeTo(os);
+            PngConstants.PNG_Signature.writeTo(os);
         }
         {
             // IHDR must be first
 
-            final byte compressionMethod = COMPRESSION_TYPE_INFLATE_DEFLATE;
-            final byte filterMethod = FILTER_METHOD_ADAPTIVE;
-            final byte interlaceMethod = INTERLACE_METHOD_NONE;
+            final byte compressionMethod = PngConstants.COMPRESSION_TYPE_INFLATE_DEFLATE;
+            final byte filterMethod = PngConstants.FILTER_METHOD_ADAPTIVE;
+            final byte interlaceMethod = PngConstants.INTERLACE_METHOD_NONE;
 
             final ImageHeader imageHeader = new ImageHeader(width, height, bitDepth,
                     colorType, compressionMethod, filterMethod, interlaceMethod);
@@ -518,7 +519,7 @@ public class PngWriter implements PngCon
         }
 
         Palette palette = null;
-        if (colorType == COLOR_TYPE_INDEXED_COLOR) {
+        if (colorType == PngConstants.COLOR_TYPE_INDEXED_COLOR) {
             // PLTE No Before first IDAT
 
             final int max_colors = hasAlpha ? 255 : 256;
@@ -539,7 +540,7 @@ public class PngWriter implements PngCon
             }
         }
 
-        final Object pixelDensityObj = params.get(PARAM_KEY_PIXEL_DENSITY);
+        final Object pixelDensityObj = params.get(ImagingConstants.PARAM_KEY_PIXEL_DENSITY);
         if (pixelDensityObj instanceof PixelDensity) {
             final PixelDensity pixelDensity = (PixelDensity) pixelDensityObj;
             if (pixelDensity.isUnitless()) {
@@ -555,13 +556,13 @@ public class PngWriter implements PngCon
             }
         }
 
-        if (params.containsKey(PARAM_KEY_XMP_XML)) {
-            final String xmpXml = (String) params.get(PARAM_KEY_XMP_XML);
+        if (params.containsKey(ImagingConstants.PARAM_KEY_XMP_XML)) {
+            final String xmpXml = (String) params.get(ImagingConstants.PARAM_KEY_XMP_XML);
             writeChunkXmpiTXt(os, xmpXml);
         }
 
-        if (params.containsKey(PARAM_KEY_PNG_TEXT_CHUNKS)) {
-            final List<?> outputTexts = (List<?>) params.get(PARAM_KEY_PNG_TEXT_CHUNKS);
+        if (params.containsKey(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS)) {
+            final List<?> outputTexts = (List<?>) params.get(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS);
             for (int i = 0; i < outputTexts.size(); i++) {
                 final PngText text = (PngText) outputTexts.get(i);
                 if (text instanceof PngText.Text) {
@@ -586,15 +587,15 @@ public class PngWriter implements PngCon
             {
                 final ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
-                final boolean useAlpha = colorType == COLOR_TYPE_GREYSCALE_WITH_ALPHA
-                        || colorType == COLOR_TYPE_TRUE_COLOR_WITH_ALPHA;
+                final boolean useAlpha = colorType == PngConstants.COLOR_TYPE_GREYSCALE_WITH_ALPHA
+                        || colorType == PngConstants.COLOR_TYPE_TRUE_COLOR_WITH_ALPHA;
 
                 final int row[] = new int[width];
                 for (int y = 0; y < height; y++) {
                     // Debug.debug("y", y + "/" + height);
                     src.getRGB(0, y, width, 1, row, 0, width);
 
-                    final byte filter_type = FILTER_TYPE_NONE;
+                    final byte filter_type = PngConstants.FILTER_TYPE_NONE;
                     baos.write(filter_type);
                     for (int x = 0; x < width; x++) {
                         final int argb = row[x];

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
Wed Nov  6 05:01:04 2013
@@ -24,7 +24,7 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageWriteException;
 
-public class PamWriter extends PnmWriter implements PnmConstants {
+public class PamWriter extends PnmWriter {
     public PamWriter() {
         super(true);
     }
@@ -33,30 +33,30 @@ public class PamWriter extends PnmWriter
     public void writeImage(final BufferedImage src, final OutputStream os,
             final Map<String, Object> params) throws ImageWriteException, IOException
{
 
-        os.write(PNM_PREFIX_BYTE);
-        os.write(PAM_RAW_CODE);
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_PREFIX_BYTE);
+        os.write(PnmConstants.PAM_RAW_CODE);
+        os.write(PnmConstants.PNM_NEWLINE);
         
         final int width = src.getWidth();
         final int height = src.getHeight();
 
         os.write(("WIDTH " + width).getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
 
         os.write(("HEIGHT " + height).getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
         
         os.write(("DEPTH 4").getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
         
         os.write(("MAXVAL 255").getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
 
         os.write(("TUPLTYPE RGB_ALPHA").getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
         
         os.write(("ENDHDR").getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
         
         for (int y = 0; y < height; y++) {
             for (int x = 0; x < width; x++) {

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=1539242&r1=1539241&r2=1539242&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  6 05:01:04 2013
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageWriteException;
 
-public class PbmWriter extends PnmWriter implements PnmConstants {
+public class PbmWriter extends PnmWriter {
     public PbmWriter(final boolean RAWBITS) {
         super(RAWBITS);
     }
@@ -31,18 +31,18 @@ public class PbmWriter extends PnmWriter
     @Override
     public void writeImage(final BufferedImage src, final OutputStream os, final Map<String,Object>
params)
             throws ImageWriteException, IOException {
-        os.write(PNM_PREFIX_BYTE);
-        os.write(RAWBITS ? PBM_RAW_CODE : PBM_TEXT_CODE);
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_PREFIX_BYTE);
+        os.write(RAWBITS ? PnmConstants.PBM_RAW_CODE : PnmConstants.PBM_TEXT_CODE);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         final int width = src.getWidth();
         final int height = src.getHeight();
 
         os.write(("" + width).getBytes("US-ASCII"));
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         os.write(("" + height).getBytes("US-ASCII"));
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
 
         int bitcache = 0;
         int bits_in_cache = 0;
@@ -73,7 +73,7 @@ public class PbmWriter extends PnmWriter
                     os.write(("" + sample).getBytes("US-ASCII")); // max
                                                                   // component
                                                                   // value
-                    os.write(PNM_SEPARATOR);
+                    os.write(PnmConstants.PNM_SEPARATOR);
                 }
             }
 

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=1539242&r1=1539241&r2=1539242&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  6 05:01:04 2013
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageWriteException;
 
-public class PgmWriter extends PnmWriter implements PnmConstants {
+public class PgmWriter extends PnmWriter {
     public PgmWriter(final boolean RAWBITS) {
         super(RAWBITS);
     }
@@ -35,19 +35,19 @@ public class PgmWriter extends PnmWriter
         // (b1 == 0x50 && b2 == 0x36)
         os.write(0x50);
         os.write(RAWBITS ? 0x35 : 0x32);
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         final int width = src.getWidth();
         final int height = src.getHeight();
 
         os.write(("" + width).getBytes("US-ASCII"));
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         os.write(("" + height).getBytes("US-ASCII"));
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         os.write(("" + 255).getBytes("US-ASCII")); // max component value
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
 
         for (int y = 0; y < height; y++) {
             for (int x = 0; x < width; x++) {
@@ -63,7 +63,7 @@ public class PgmWriter extends PnmWriter
                     os.write(("" + sample).getBytes("US-ASCII")); // max
                                                                   // component
                                                                   // value
-                    os.write(PNM_SEPARATOR);
+                    os.write(PnmConstants.PNM_SEPARATOR);
                 }
             }
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/pnm/PnmConstants.java
Wed Nov  6 05:01:04 2013
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.imaging.formats.pnm;
 
-public interface PnmConstants {
+public class PnmConstants {
     public static final byte PNM_PREFIX_BYTE = 0x50; // P
 
     public static final byte PBM_TEXT_CODE = 0x31; // Textual Bitmap

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=1539242&r1=1539241&r2=1539242&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  6 05:01:04 2013
@@ -42,7 +42,7 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.palette.PaletteFactory;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class PnmImageParser extends ImageParser implements PnmConstants {
+public class PnmImageParser extends ImageParser {
 
     public PnmImageParser() {
         super.setByteOrder(ByteOrder.LITTLE_ENDIAN);
@@ -85,42 +85,42 @@ public class PnmImageParser extends Imag
         final byte identifier1 = readByte("Identifier1", is, "Not a Valid PNM File");
         final byte identifier2 = readByte("Identifier2", is, "Not a Valid PNM File");
 
-        if (identifier1 != PNM_PREFIX_BYTE) {
+        if (identifier1 != PnmConstants.PNM_PREFIX_BYTE) {
             throw new ImageReadException("PNM file has invalid prefix byte 1");
         }
         
         final WhiteSpaceReader wsr = new WhiteSpaceReader(is);
         
-        if (identifier2 == PBM_TEXT_CODE ||
-                identifier2 == PBM_RAW_CODE ||
-                identifier2 == PGM_TEXT_CODE ||
-                identifier2 == PGM_RAW_CODE ||
-                identifier2 == PPM_TEXT_CODE ||
-                identifier2 == PPM_RAW_CODE) {
+        if (identifier2 == PnmConstants.PBM_TEXT_CODE ||
+                identifier2 == PnmConstants.PBM_RAW_CODE ||
+                identifier2 == PnmConstants.PGM_TEXT_CODE ||
+                identifier2 == PnmConstants.PGM_RAW_CODE ||
+                identifier2 == PnmConstants.PPM_TEXT_CODE ||
+                identifier2 == PnmConstants.PPM_RAW_CODE) {
             
             final int width = Integer.parseInt(wsr.readtoWhiteSpace());
             final int height = Integer.parseInt(wsr.readtoWhiteSpace());
     
-            if (identifier2 == PBM_TEXT_CODE) {
+            if (identifier2 == PnmConstants.PBM_TEXT_CODE) {
                 return new PbmFileInfo(width, height, false);
-            } else if (identifier2 == PBM_RAW_CODE) {
+            } else if (identifier2 == PnmConstants.PBM_RAW_CODE) {
                 return new PbmFileInfo(width, height, true);
-            } else if (identifier2 == PGM_TEXT_CODE) {
+            } else if (identifier2 == PnmConstants.PGM_TEXT_CODE) {
                 final int maxgray = Integer.parseInt(wsr.readtoWhiteSpace());
                 return new PgmFileInfo(width, height, false, maxgray);
-            } else if (identifier2 == PGM_RAW_CODE) {
+            } else if (identifier2 == PnmConstants.PGM_RAW_CODE) {
                 final int maxgray = Integer.parseInt(wsr.readtoWhiteSpace());
                 return new PgmFileInfo(width, height, true, maxgray);
-            } else if (identifier2 == PPM_TEXT_CODE) {
+            } else if (identifier2 == PnmConstants.PPM_TEXT_CODE) {
                 final int max = Integer.parseInt(wsr.readtoWhiteSpace());
                 return new PpmFileInfo(width, height, false, max);
-            } else if (identifier2 == PPM_RAW_CODE) {
+            } else if (identifier2 == PnmConstants.PPM_RAW_CODE) {
                 final int max = Integer.parseInt(wsr.readtoWhiteSpace());
                 return new PpmFileInfo(width, height, true, max);
             } else {
                 throw new ImageReadException("PNM file has invalid header.");
             }
-        } else if (identifier2 == PAM_RAW_CODE) {
+        } else if (identifier2 == PnmConstants.PAM_RAW_CODE) {
             int width = -1;
             boolean seenWidth = false;
             int height = -1;

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=1539242&r1=1539241&r2=1539242&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  6 05:01:04 2013
@@ -23,7 +23,7 @@ import java.util.Map;
 
 import org.apache.commons.imaging.ImageWriteException;
 
-public class PpmWriter extends PnmWriter implements PnmConstants {
+public class PpmWriter extends PnmWriter {
     public PpmWriter(final boolean RAWBITS) {
         super(RAWBITS);
     }
@@ -35,19 +35,19 @@ public class PpmWriter extends PnmWriter
         // (b1 == 0x50 && b2 == 0x36)
         os.write(0x50);
         os.write(RAWBITS ? 0x36 : 0x33);
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         final int width = src.getWidth();
         final int height = src.getHeight();
 
         os.write(("" + width).getBytes("US-ASCII"));
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         os.write(("" + height).getBytes("US-ASCII"));
-        os.write(PNM_SEPARATOR);
+        os.write(PnmConstants.PNM_SEPARATOR);
 
         os.write(("" + 255).getBytes("US-ASCII")); // max component value
-        os.write(PNM_NEWLINE);
+        os.write(PnmConstants.PNM_NEWLINE);
 
         for (int y = 0; y < height; y++) {
             for (int x = 0; x < width; x++) {
@@ -63,14 +63,14 @@ public class PpmWriter extends PnmWriter
                 } else {
                     os.write(("" + red).getBytes("US-ASCII")); // max component
                                                                // value
-                    os.write(PNM_SEPARATOR);
+                    os.write(PnmConstants.PNM_SEPARATOR);
                     os.write(("" + green).getBytes("US-ASCII")); // max
                                                                  // component
                                                                  // value
-                    os.write(PNM_SEPARATOR);
+                    os.write(PnmConstants.PNM_SEPARATOR);
                     os.write(("" + blue).getBytes("US-ASCII")); // max component
                                                                 // value
-                    os.write(PNM_SEPARATOR);
+                    os.write(PnmConstants.PNM_SEPARATOR);
                 }
             }
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaConstants.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaConstants.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaConstants.java
Wed Nov  6 05:01:04 2013
@@ -16,6 +16,6 @@
  */
 package org.apache.commons.imaging.formats.tga;
 
-public interface TgaConstants {
+public class TgaConstants {
 
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccConstants.java
Wed Nov  6 05:01:04 2013
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.imaging.icc;
 
-public interface IccConstants {
+public class IccConstants {
     public final static int IEC = (((0xff & 'I') << 24) | ((0xff & 'E') <<
16)
             | ((0xff & 'C') << 8) | ((0xff & ' ') << 0));
     public final static int sRGB = (((0xff & 's') << 24) | ((0xff & 'R') <<
16)

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
Wed Nov  6 05:01:04 2013
@@ -22,7 +22,7 @@ import java.io.StringWriter;
 
 import org.apache.commons.imaging.ImageReadException;
 
-public class IccProfileInfo implements IccConstants {
+public class IccProfileInfo {
 
     private final byte data[];
     public final int ProfileSize;
@@ -81,7 +81,7 @@ public class IccProfileInfo implements I
     }
 
     public boolean issRGB() {
-        final boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == sRGB));
+        final boolean result = ((DeviceManufacturer == IccConstants.IEC) && (DeviceModel
== IccConstants.sRGB));
         return result;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
Wed Nov  6 05:01:04 2013
@@ -30,7 +30,7 @@ import org.apache.commons.imaging.util.C
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class IccProfileParser extends BinaryFileParser implements IccConstants {
+public class IccProfileParser extends BinaryFileParser {
     public IccProfileParser() {
         this.setByteOrder(ByteOrder.BIG_ENDIAN);
     }
@@ -357,7 +357,7 @@ public class IccProfileParser extends Bi
                 printCharQuad("DeviceModel", DeviceModel);
             }
 
-            final boolean result = ((DeviceManufacturer == IEC) && (DeviceModel ==
sRGB));
+            final boolean result = ((DeviceManufacturer == IccConstants.IEC) && (DeviceModel
== IccConstants.sRGB));
             canThrow = true;
             return result;
         } finally {

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java?rev=1539242&r1=1539241&r2=1539242&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccTag.java
Wed Nov  6 05:01:04 2013
@@ -28,7 +28,7 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.ByteOrder;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class IccTag implements IccConstants {
+public class IccTag {
     public final int signature;
     public final int offset, length;
     public final IccTagType fIccTagType;



Mime
View raw message