commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1534734 - in /commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging: formats/jpeg/decoder/ formats/png/ formats/png/chunks/ formats/psd/ formats/tiff/write/ icc/ palette/
Date Tue, 22 Oct 2013 19:07:12 GMT
Author: damjan
Date: Tue Oct 22 19:07:12 2013
New Revision: 1534734

URL: http://svn.apache.org/r1534734
Log:
Encapsulate more public mutable arrays.

Jira issue key: IMAGING-117


Modified:
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileInfo.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/icc/IccProfileParser.java
    commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
Tue Oct 22 19:07:12 2013
@@ -28,7 +28,6 @@ import java.util.Properties;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.common.BinaryFileParser;
 import org.apache.commons.imaging.common.bytesource.ByteSource;
-import org.apache.commons.imaging.formats.jpeg.Block;
 import org.apache.commons.imaging.formats.jpeg.JpegConstants;
 import org.apache.commons.imaging.formats.jpeg.JpegUtils;
 import org.apache.commons.imaging.formats.jpeg.ZigZag;

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
Tue Oct 22 19:07:12 2013
@@ -485,11 +485,11 @@ public class PngImageParser extends Imag
         switch (ColorType) {
         case COLOR_TYPE_GREYSCALE: // 1,2,4,8,16 Each pixel is a grayscale
             // sample.
-            return new TransparencyFilterGrayscale(pngChunktRNS.bytes);
+            return new TransparencyFilterGrayscale(pngChunktRNS.getBytes());
         case COLOR_TYPE_TRUE_COLOR: // 8,16 Each pixel is an R,G,B triple.
-            return new TransparencyFilterTrueColor(pngChunktRNS.bytes);
+            return new TransparencyFilterTrueColor(pngChunktRNS.getBytes());
         case COLOR_TYPE_INDEXED_COLOR: // 1,2,4,8 Each pixel is a palette index;
-            return new TransparencyFilterIndexedColor(pngChunktRNS.bytes);
+            return new TransparencyFilterIndexedColor(pngChunktRNS.getBytes());
         case COLOR_TYPE_GREYSCALE_WITH_ALPHA: // 8,16 Each pixel is a grayscale
             // sample,
         case COLOR_TYPE_TRUE_COLOR_WITH_ALPHA: // 8,16 Each pixel is an R,G,B
@@ -690,7 +690,7 @@ public class PngImageParser extends Imag
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         for (int i = 0; i < IDATs.size(); i++) {
             final PngChunkIdat pngChunkIDAT = (PngChunkIdat) IDATs.get(i);
-            final byte bytes[] = pngChunkIDAT.bytes;
+            final byte bytes[] = pngChunkIDAT.getBytes();
             // System.out.println(i + ": bytes: " + bytes.length);
             baos.write(bytes);
         }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunk.java
Tue Oct 22 19:07:12 2013
@@ -24,9 +24,9 @@ public class PngChunk extends BinaryFile
     public final int length;
     public final int chunkType;
     public final int crc;
-    public final byte bytes[];
+    private final byte bytes[];
 
-    public final boolean propertyBits[];
+    private final boolean propertyBits[];
     public final boolean ancillary, isPrivate, reserved, safeToCopy;
 
     public PngChunk(final int Length, final int ChunkType, final int CRC, final byte bytes[])
{
@@ -50,8 +50,16 @@ public class PngChunk extends BinaryFile
         safeToCopy = propertyBits[3];
     }
 
+    public byte[] getBytes() {
+        return bytes;
+    }
+
+    public boolean[] getPropertyBits() {
+        return propertyBits.clone();
+    }
+
     protected ByteArrayInputStream getDataStream() {
-        final ByteArrayInputStream is = new ByteArrayInputStream(bytes);
+        final ByteArrayInputStream is = new ByteArrayInputStream(getBytes());
         return is;
     }
 

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/png/chunks/PngChunkPlte.java
Tue Oct 22 19:07:12 2013
@@ -23,7 +23,7 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.formats.png.GammaCorrection;
 
 public class PngChunkPlte extends PngChunk {
-    public final int rgb[];
+    private final int rgb[];
 
     public PngChunkPlte(final int length, final int ChunkType, final int CRC, final byte
bytes[])
             throws ImageReadException, IOException {
@@ -51,6 +51,10 @@ public class PngChunkPlte extends PngChu
         }
     }
 
+    public int[] getRgb() {
+        return rgb;
+    }
+
     public int getRGB(final int index) throws ImageReadException {
         if ((index < 0) || (index >= rgb.length)) {
             throw new ImageReadException("PNG: unknown Palette reference: "

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdHeaderInfo.java
Tue Oct 22 19:07:12 2013
@@ -22,7 +22,7 @@ import java.nio.charset.Charset;
 
 public class PsdHeaderInfo {
     public final int Version;
-    public final byte Reserved[];
+    private final byte Reserved[];
     public final int Channels;
     public final int Rows;
     public final int Columns;
@@ -41,6 +41,10 @@ public class PsdHeaderInfo {
 
     }
 
+    public byte[] getReserved() {
+        return Reserved.clone();
+    }
+
     public void dump() {
         final PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
         dump(pw);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/ImageDataOffsets.java
Tue Oct 22 19:07:12 2013
@@ -19,11 +19,11 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.formats.tiff.TiffElement;
 
 class ImageDataOffsets {
-    public final int imageDataOffsets[];
-    public final TiffOutputField imageDataOffsetsField;
-    public final TiffOutputItem outputItems[];
-
-    public ImageDataOffsets(final TiffElement.DataElement imageData[],
+    final int imageDataOffsets[];
+    final TiffOutputField imageDataOffsetsField;
+    final TiffOutputItem outputItems[];
+    
+    ImageDataOffsets(final TiffElement.DataElement imageData[],
             final int[] imageDataOffsets,
             final TiffOutputField imageDataOffsetsField) {
         this.imageDataOffsets = imageDataOffsets;

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=1534734&r1=1534733&r2=1534734&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
Tue Oct 22 19:07:12 2013
@@ -24,7 +24,7 @@ import org.apache.commons.imaging.ImageR
 
 public class IccProfileInfo implements IccConstants {
 
-    public final byte data[];
+    private final byte data[];
     public final int ProfileSize;
     public final int CMMTypeSignature;
     public final int ProfileVersion;
@@ -38,8 +38,8 @@ public class IccProfileInfo implements I
     public final int DeviceModel;
     public final int RenderingIntent;
     public final int ProfileCreatorSignature;
-    public final byte ProfileID[];
-    public final IccTag tags[];
+    private final byte ProfileID[];
+    private final IccTag tags[];
 
     public IccProfileInfo(final byte data[], final int ProfileSize, final int CMMTypeSignature,
             final int ProfileVersion, final int ProfileDeviceClassSignature,
@@ -68,6 +68,18 @@ public class IccProfileInfo implements I
         this.tags = tags;
     }
 
+    public byte[] getData() {
+        return data;
+    }
+
+    public byte[] getProfileID() {
+        return ProfileID;
+    }
+
+    public IccTag[] getTags() {
+        return tags;
+    }
+
     public boolean issRGB() {
         final boolean result = ((DeviceManufacturer == IEC) && (DeviceModel == 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=1534734&r1=1534733&r2=1534734&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
Tue Oct 22 19:07:12 2013
@@ -76,7 +76,7 @@ public class IccProfileParser extends Bi
             is.close();
             is = null;
 
-            for (final IccTag tag : result.tags) {
+            for (final IccTag tag : result.getTags()) {
                 final byte bytes[] = byteSource.getBlock(tag.offset, tag.length);
                 // Debug.debug("bytes: " + bytes.length);
                 tag.setData(bytes);

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java?rev=1534734&r1=1534733&r2=1534734&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
(original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/palette/ColorSpaceSubset.java
Tue Oct 22 19:07:12 2013
@@ -20,13 +20,13 @@ import java.io.Serializable;
 import java.util.Comparator;
 
 class ColorSpaceSubset {
-    public final int mins[], maxs[];
-    public final int precision;
-    public final int precision_mask;
-    public final int total;
-    public int rgb; // median
+    final int mins[], maxs[];
+    final int precision;
+    final int precision_mask;
+    final int total;
+    int rgb; // median
 
-    public ColorSpaceSubset(final int total, final int precision) {
+    ColorSpaceSubset(final int total, final int precision) {
         this.total = total;
         this.precision = precision;
         precision_mask = (1 << precision) - 1;
@@ -41,7 +41,7 @@ class ColorSpaceSubset {
         rgb = -1;
     }
 
-    public ColorSpaceSubset(final int total, final int precision, final int mins[], final
int maxs[],
+    ColorSpaceSubset(final int total, final int precision, final int mins[], final int maxs[],
             final int table[]) {
         this.total = total;
         this.precision = precision;



Mime
View raw message