commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1342971 [9/20] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/bmp/ main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/ main/java/org/apache/commons/imaging/formats/bmp/writers/ main/java/org...
Date Sat, 26 May 2012 21:19:22 GMT
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java Sat May 26 21:19:03 2012
@@ -46,24 +46,20 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.psd.datareaders.UncompressedDataReader;
 import org.apache.commons.imaging.util.Debug;
 
-public class PsdImageParser extends ImageParser
-{
+public class PsdImageParser extends ImageParser {
 
-    public PsdImageParser()
-    {
+    public PsdImageParser() {
         super.setByteOrder(BYTE_ORDER_MSB);
         // setDebug(true);
     }
 
     @Override
-    public String getName()
-    {
+    public String getName() {
         return "PSD-Custom";
     }
 
     @Override
-    public String getDefaultExtension()
-    {
+    public String getDefaultExtension() {
         return DEFAULT_EXTENSION;
     }
 
@@ -72,37 +68,30 @@ public class PsdImageParser extends Imag
     private static final String ACCEPTED_EXTENSIONS[] = { DEFAULT_EXTENSION, };
 
     @Override
-    protected String[] getAcceptedExtensions()
-    {
+    protected String[] getAcceptedExtensions() {
         return ACCEPTED_EXTENSIONS;
     }
 
     @Override
-    protected ImageFormat[] getAcceptedTypes()
-    {
+    protected ImageFormat[] getAcceptedTypes() {
         return new ImageFormat[] { ImageFormat.IMAGE_FORMAT_PSD, //
         };
     }
 
     private PsdHeaderInfo readHeader(ByteSource byteSource)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         InputStream is = null;
 
-        try
-        {
+        try {
             is = byteSource.getInputStream();
 
             return readHeader(is);
-        } finally
-        {
-            try
-            {
+        } finally {
+            try {
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e)
-            {
+            } catch (Exception e) {
                 Debug.debug(e);
             }
 
@@ -110,8 +99,7 @@ public class PsdImageParser extends Imag
     }
 
     private PsdHeaderInfo readHeader(InputStream is) throws ImageReadException,
-            IOException
-    {
+            IOException {
         readAndVerifyBytes(is, new byte[] { 56, 66, 80, 83 },
                 "Not a Valid PSD File");
 
@@ -133,8 +121,7 @@ public class PsdImageParser extends Imag
     }
 
     private ImageContents readImageContents(InputStream is)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         PsdHeaderInfo header = readHeader(is);
 
         int ColorModeDataLength = read4Bytes("ColorModeDataLength", is,
@@ -178,15 +165,13 @@ public class PsdImageParser extends Imag
     }
 
     private List<ImageResourceBlock> readImageResourceBlocks(byte bytes[],
-                                                             int imageResourceIDs[], int maxBlocksToRead)
-            throws ImageReadException, IOException
-    {
+            int imageResourceIDs[], int maxBlocksToRead)
+            throws ImageReadException, IOException {
         return readImageResourceBlocks(new ByteArrayInputStream(bytes),
                 imageResourceIDs, maxBlocksToRead, bytes.length);
     }
 
-    private boolean keepImageResourceBlock(int ID, int imageResourceIDs[])
-    {
+    private boolean keepImageResourceBlock(int ID, int imageResourceIDs[]) {
         if (imageResourceIDs == null)
             return true;
 
@@ -198,13 +183,11 @@ public class PsdImageParser extends Imag
     }
 
     private List<ImageResourceBlock> readImageResourceBlocks(InputStream is,
-                                                             int imageResourceIDs[], int maxBlocksToRead, int available)
-            throws ImageReadException, IOException
-    {
+            int imageResourceIDs[], int maxBlocksToRead, int available)
+            throws ImageReadException, IOException {
         List<ImageResourceBlock> result = new ArrayList<ImageResourceBlock>();
 
-        while (available > 0)
-        {
+        while (available > 0) {
             readAndVerifyBytes(is, new byte[] { 56, 66, 73, 77 },
                     "Not a Valid PSD File");
             available -= 4;
@@ -218,8 +201,7 @@ public class PsdImageParser extends Imag
             byte nameBytes[] = readByteArray("NameData", nameLength, is,
                     "Not a Valid PSD File");
             available -= nameLength;
-            if (((nameLength + 1) % 2) != 0)
-            {
+            if (((nameLength + 1) % 2) != 0) {
                 int NameDiscard = readByte("NameDiscard", is,
                         "Not a Valid PSD File");
                 available -= 1;
@@ -235,15 +217,13 @@ public class PsdImageParser extends Imag
                     "Not a Valid PSD File");
             available -= DataSize;
 
-            if ((DataSize % 2) != 0)
-            {
+            if ((DataSize % 2) != 0) {
                 int DataDiscard = readByte("DataDiscard", is,
                         "Not a Valid PSD File");
                 available -= 1;
             }
 
-            if (keepImageResourceBlock(id, imageResourceIDs))
-            {
+            if (keepImageResourceBlock(id, imageResourceIDs)) {
                 result.add(new ImageResourceBlock(id, nameBytes, Data));
 
                 if ((maxBlocksToRead >= 0)
@@ -257,14 +237,12 @@ public class PsdImageParser extends Imag
         return result;
     }
 
-    private List<ImageResourceBlock> readImageResourceBlocks(ByteSource byteSource,
-                                                             int imageResourceIDs[], int maxBlocksToRead)
-            throws ImageReadException, IOException
-    {
+    private List<ImageResourceBlock> readImageResourceBlocks(
+            ByteSource byteSource, int imageResourceIDs[], int maxBlocksToRead)
+            throws ImageReadException, IOException {
         InputStream is = null;
 
-        try
-        {
+        try {
             is = byteSource.getInputStream();
 
             ImageContents imageContents = readImageContents(is);
@@ -278,15 +256,12 @@ public class PsdImageParser extends Imag
 
             return readImageResourceBlocks(ImageResources, imageResourceIDs,
                     maxBlocksToRead);
-        } finally
-        {
-            try
-            {
+        } finally {
+            try {
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e)
-            {
+            } catch (Exception e) {
                 Debug.debug(e);
             }
 
@@ -302,8 +277,7 @@ public class PsdImageParser extends Imag
     private static final int PSD_HEADER_LENGTH = 26;
 
     private InputStream getInputStream(ByteSource byteSource, int section)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         InputStream is = null;
         boolean notFound = false;
         try {
@@ -311,45 +285,46 @@ public class PsdImageParser extends Imag
 
             if (section == PSD_SECTION_HEADER)
                 return is;
-    
+
             skipBytes(is, PSD_HEADER_LENGTH);
             // is.skip(kHeaderLength);
-    
+
             int ColorModeDataLength = read4Bytes("ColorModeDataLength", is,
                     "Not a Valid PSD File");
-    
+
             if (section == PSD_SECTION_COLOR_MODE)
                 return is;
-    
+
             skipBytes(is, ColorModeDataLength);
             // byte ColorModeData[] = readByteArray("ColorModeData",
             // ColorModeDataLength, is, "Not a Valid PSD File");
-    
+
             int ImageResourcesLength = read4Bytes("ImageResourcesLength", is,
                     "Not a Valid PSD File");
-    
+
             if (section == PSD_SECTION_IMAGE_RESOURCES)
                 return is;
-    
+
             skipBytes(is, ImageResourcesLength);
             // byte ImageResources[] = readByteArray("ImageResources",
             // ImageResourcesLength, is, "Not a Valid PSD File");
-    
-            int LayerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength", is,
-                    "Not a Valid PSD File");
-    
+
+            int LayerAndMaskDataLength = read4Bytes("LayerAndMaskDataLength",
+                    is, "Not a Valid PSD File");
+
             if (section == PSD_SECTION_LAYER_AND_MASK_DATA)
                 return is;
-    
+
             skipBytes(is, LayerAndMaskDataLength);
             // byte LayerAndMaskData[] = readByteArray("LayerAndMaskData",
             // LayerAndMaskDataLength, is, "Not a Valid PSD File");
-    
-            int Compression = read2Bytes("Compression", is, "Not a Valid PSD File");
-    
+
+            int Compression = read2Bytes("Compression", is,
+                    "Not a Valid PSD File");
+
             // byte ImageData[] = readByteArray("ImageData",
             // LayerAndMaskDataLength, is, "Not a Valid PSD File");
-    
+
             if (section == PSD_SECTION_IMAGE_DATA)
                 return is;
             notFound = true;
@@ -366,12 +341,10 @@ public class PsdImageParser extends Imag
     }
 
     private byte[] getData(ByteSource byteSource, int section)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         InputStream is = null;
 
-        try
-        {
+        try {
             is = byteSource.getInputStream();
 
             // PsdHeaderInfo header = readHeader(is);
@@ -424,15 +397,12 @@ public class PsdImageParser extends Imag
             // is,
             // "Not a Valid PSD File");
 
-        } finally
-        {
-            try
-            {
+        } finally {
+            try {
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e)
-            {
+            } catch (Exception e) {
                 Debug.debug(e);
             }
 
@@ -442,25 +412,20 @@ public class PsdImageParser extends Imag
     }
 
     private ImageContents readImageContents(ByteSource byteSource)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         InputStream is = null;
 
-        try
-        {
+        try {
             is = byteSource.getInputStream();
 
             ImageContents imageContents = readImageContents(is);
             return imageContents;
-        } finally
-        {
-            try
-            {
+        } finally {
+            try {
                 if (is != null) {
                     is.close();
                 }
-            } catch (Exception e)
-            {
+            } catch (Exception e) {
                 Debug.debug(e);
             }
 
@@ -472,10 +437,9 @@ public class PsdImageParser extends Imag
 
     @Override
     public byte[] getICCProfileBytes(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         List<ImageResourceBlock> blocks = readImageResourceBlocks(byteSource,
-                new int[]{IMAGE_RESOURCE_ID_ICC_PROFILE,}, 1);
+                new int[] { IMAGE_RESOURCE_ID_ICC_PROFILE, }, 1);
 
         if ((blocks == null) || (blocks.size() < 1))
             return null;
@@ -489,8 +453,7 @@ public class PsdImageParser extends Imag
 
     @Override
     public Dimension getImageSize(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         PsdHeaderInfo bhi = readHeader(byteSource);
         if (bhi == null)
             throw new ImageReadException("PSD: couldn't read header");
@@ -499,28 +462,23 @@ public class PsdImageParser extends Imag
 
     }
 
-    public byte[] embedICCProfile(byte image[], byte profile[])
-    {
+    public byte[] embedICCProfile(byte image[], byte profile[]) {
         return null;
     }
 
     @Override
-    public boolean embedICCProfile(File src, File dst, byte profile[])
-    {
+    public boolean embedICCProfile(File src, File dst, byte profile[]) {
         return false;
     }
 
     @Override
     public IImageMetadata getMetadata(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         return null;
     }
 
-    private int getChannelsPerMode(int mode)
-    {
-        switch (mode)
-        {
+    private int getChannelsPerMode(int mode) {
+        switch (mode) {
         case 0: // Bitmap
             return 1;
         case 1: // Grayscale
@@ -545,8 +503,7 @@ public class PsdImageParser extends Imag
 
     @Override
     public ImageInfo getImageInfo(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         ImageContents imageContents = readImageContents(byteSource);
         // ImageContents imageContents = readImage(byteSource, false);
 
@@ -590,8 +547,7 @@ public class PsdImageParser extends Imag
         int ColorType = ImageInfo.COLOR_TYPE_UNKNOWN;
 
         String compressionAlgorithm;
-        switch (imageContents.Compression)
-        {
+        switch (imageContents.Compression) {
         case 0:
             compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_NONE;
             break;
@@ -612,10 +568,9 @@ public class PsdImageParser extends Imag
     }
 
     // TODO not used
-    private ImageResourceBlock findImageResourceBlock(List<ImageResourceBlock> blocks, int ID)
-    {
-        for (int i = 0; i < blocks.size(); i++)
-        {
+    private ImageResourceBlock findImageResourceBlock(
+            List<ImageResourceBlock> blocks, int ID) {
+        for (int i = 0; i < blocks.size(); i++) {
             ImageResourceBlock block = blocks.get(i);
 
             if (block.id == ID)
@@ -626,8 +581,7 @@ public class PsdImageParser extends Imag
 
     @Override
     public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         pw.println("gif.dumpImageFile");
 
         {
@@ -643,15 +597,15 @@ public class PsdImageParser extends Imag
             imageContents.dump(pw);
             imageContents.header.dump(pw);
 
-            List<ImageResourceBlock> blocks = readImageResourceBlocks(byteSource,
+            List<ImageResourceBlock> blocks = readImageResourceBlocks(
+                    byteSource,
                     // fImageContents.ImageResources,
                     null, -1);
 
             pw.println("blocks.size(): " + blocks.size());
 
             // System.out.println("gif.blocks: " + blocks.blocks.size());
-            for (int i = 0; i < blocks.size(); i++)
-            {
+            for (int i = 0; i < blocks.size(); i++) {
                 ImageResourceBlock block = blocks.get(i);
                 pw.println("\t" + i + " (" + Integer.toHexString(block.id)
                         + ", " + "'"
@@ -678,8 +632,7 @@ public class PsdImageParser extends Imag
 
     @Override
     public BufferedImage getBufferedImage(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         ImageContents imageContents = readImageContents(byteSource);
         // ImageContents imageContents = readImage(byteSource, false);
 
@@ -699,7 +652,7 @@ public class PsdImageParser extends Imag
         // fImageContents.blocks, kGraphicControlExtension);
 
         List<ImageResourceBlock> blocks = readImageResourceBlocks(byteSource,
-                // fImageContents.ImageResources,
+        // fImageContents.ImageResources,
                 null, -1);
 
         int width = header.Columns;
@@ -715,8 +668,7 @@ public class PsdImageParser extends Imag
                 .getColorBufferedImage(width, height, hasAlpha);
 
         DataParser dataParser;
-        switch (imageContents.header.Mode)
-        {
+        switch (imageContents.header.Mode) {
         case 0: // bitmap
             dataParser = new DataParserBitmap();
             break;
@@ -734,7 +686,7 @@ public class PsdImageParser extends Imag
             dataParser = new DataParserLab();
             break;
         case COLOR_MODE_INDEXED:
-            // case 2 : // Indexed=2;
+        // case 2 : // Indexed=2;
         {
 
             byte ColorModeData[] = getData(byteSource, PSD_SECTION_COLOR_MODE);
@@ -760,8 +712,7 @@ public class PsdImageParser extends Imag
                     + imageContents.header.Mode);
         }
         DataReader fDataReader;
-        switch (imageContents.Compression)
-        {
+        switch (imageContents.Compression) {
         case 0:
             fDataReader = new UncompressedDataReader(dataParser);
             break;
@@ -775,8 +726,7 @@ public class PsdImageParser extends Imag
         {
             InputStream is = null;
 
-            try
-            {
+            try {
                 is = getInputStream(byteSource, PSD_SECTION_IMAGE_DATA);
                 fDataReader.readData(is, result, imageContents, this);
 
@@ -784,14 +734,11 @@ public class PsdImageParser extends Imag
                 // is.
                 // ImageContents imageContents = readImageContents(is);
                 // return imageContents;
-            } finally
-            {
-                try
-                {
+            } finally {
+                try {
                     if (is != null)
                         is.close();
-                } catch (Exception e)
-                {
+                } catch (Exception e) {
                     Debug.debug(e);
                 }
 
@@ -810,7 +757,7 @@ public class PsdImageParser extends Imag
     /**
      * Extracts embedded XML metadata as XML string.
      * <p>
-     *
+     * 
      * @param byteSource
      *            File containing image data.
      * @param params
@@ -819,8 +766,7 @@ public class PsdImageParser extends Imag
      */
     @Override
     public String getXmpXml(ByteSource byteSource, Map params)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
 
         ImageContents imageContents = readImageContents(byteSource);
 
@@ -832,17 +778,15 @@ public class PsdImageParser extends Imag
             throw new ImageReadException("PSD: Couldn't read Header");
 
         List<ImageResourceBlock> blocks = readImageResourceBlocks(byteSource,
-                new int[]{IMAGE_RESOURCE_ID_XMP,}, -1);
+                new int[] { IMAGE_RESOURCE_ID_XMP, }, -1);
 
         if ((blocks == null) || (blocks.size() < 1))
             return null;
 
         List<ImageResourceBlock> xmpBlocks = new ArrayList<ImageResourceBlock>();
-        if (false)
-        {
+        if (false) {
             // TODO: for PSD 7 and later, verify "XMP" name.
-            for (int i = 0; i < blocks.size(); i++)
-            {
+            for (int i = 0; i < blocks.size(); i++) {
                 ImageResourceBlock block = blocks.get(i);
                 if (!block.getName().equals(BLOCK_NAME_XMP))
                     continue;
@@ -859,15 +803,13 @@ public class PsdImageParser extends Imag
 
         ImageResourceBlock block = xmpBlocks.get(0);
 
-        try
-        {
+        try {
             // segment data is UTF-8 encoded xml.
             String xml = new String(block.data, 0, block.data.length, "utf-8");
             return xml;
-        } catch (UnsupportedEncodingException e)
-        {
+        } catch (UnsupportedEncodingException e) {
             throw new ImageReadException("Invalid JPEG XMP Segment.");
         }
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java Sat May 26 21:19:03 2012
@@ -22,11 +22,9 @@ import java.awt.image.DataBuffer;
 import org.apache.commons.imaging.formats.psd.ImageContents;
 import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
 
-public abstract class DataParser
-{
+public abstract class DataParser {
     public final void parseData(int data[][][], BufferedImage bi,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         DataBuffer buffer = bi.getRaster().getDataBuffer();
 
         PsdHeaderInfo header = imageContents.header;
@@ -34,8 +32,7 @@ public abstract class DataParser
         int height = header.Rows;
 
         for (int y = 0; y < height; y++)
-            for (int x = 0; x < width; x++)
-            {
+            for (int x = 0; x < width; x++) {
                 int rgb = getRGB(data, x, y, imageContents);
                 buffer.setElem(y * width + x, rgb);
             }
@@ -47,9 +44,8 @@ public abstract class DataParser
 
     public abstract int getBasicChannelsCount();
 
-    public void dump()
-    {
+    public void dump() {
 
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java Sat May 26 21:19:03 2012
@@ -18,19 +18,17 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserBitmap extends DataParser
-{
+public class DataParserBitmap extends DataParser {
 
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int sample = 0xff & data[0][y][x];
         if (sample == 0)
             sample = 255;
         else
             sample = 0;
-        //                    sample = 255- sample;
+        // sample = 255- sample;
         int alpha = 0xff;
 
         int rgb = ((0xff & alpha) << 24) | ((0xff & sample) << 16)
@@ -40,9 +38,8 @@ public class DataParserBitmap extends Da
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 1;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java Sat May 26 21:19:03 2012
@@ -19,12 +19,10 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.color.ColorConversions;
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserCmyk extends DataParser
-{
+public class DataParserCmyk extends DataParser {
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int sc = 0xff & data[0][y][x];
         int sm = 0xff & data[1][y][x];
         int sy = 0xff & data[2][y][x];
@@ -42,9 +40,8 @@ public class DataParserCmyk extends Data
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 4;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java Sat May 26 21:19:03 2012
@@ -18,12 +18,10 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserGrayscale extends DataParser
-{
+public class DataParserGrayscale extends DataParser {
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int sample = 0xff & data[0][y][x];
         int alpha = 0xff;
 
@@ -34,9 +32,8 @@ public class DataParserGrayscale extends
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 1;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java Sat May 26 21:19:03 2012
@@ -18,15 +18,12 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserIndexed extends DataParser
-{
+public class DataParserIndexed extends DataParser {
     private final int ColorTable[];
 
-    public DataParserIndexed(byte ColorModeData[])
-    {
+    public DataParserIndexed(byte ColorModeData[]) {
         ColorTable = new int[256];
-        for (int i = 0; i < 256; i++)
-        {
+        for (int i = 0; i < 256; i++) {
             int red = 0xff & ColorModeData[0 * 256 + i];
             int green = 0xff & ColorModeData[1 * 256 + i];
             int blue = 0xff & ColorModeData[2 * 256 + i];
@@ -41,8 +38,7 @@ public class DataParserIndexed extends D
 
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int sample = 0xff & data[0][y][x];
         int rgb = ColorTable[sample];
 
@@ -50,9 +46,8 @@ public class DataParserIndexed extends D
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 1;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java Sat May 26 21:19:03 2012
@@ -19,18 +19,15 @@ package org.apache.commons.imaging.forma
 import org.apache.commons.imaging.color.ColorConversions;
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserLab extends DataParser
-{
+public class DataParserLab extends DataParser {
 
-    public DataParserLab()
-    {
+    public DataParserLab() {
 
     }
 
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int cieL = 0xff & data[0][y][x];
         int cieA = 0xff & data[1][y][x];
         int cieB = 0xff & data[2][y][x];
@@ -44,17 +41,16 @@ public class DataParserLab extends DataP
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 3;
     }
 
     @Override
-    public void dump()
-    {
-        //        for(int i=0;i<3;i++)
-        //        {
-        //            System.out.println("CIE: " + i + ": min: " + mins[i] + ", max: " + maxs[i]);
-        //        }
+    public void dump() {
+        // for(int i=0;i<3;i++)
+        // {
+        // System.out.println("CIE: " + i + ": min: " + mins[i] + ", max: " +
+        // maxs[i]);
+        // }
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java Sat May 26 21:19:03 2012
@@ -18,12 +18,10 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserRgb extends DataParser
-{
+public class DataParserRgb extends DataParser {
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         int red = 0xff & data[0][y][x];
         int green = 0xff & data[1][y][x];
         int blue = 0xff & data[2][y][x];
@@ -36,9 +34,8 @@ public class DataParserRgb extends DataP
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 3;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java Sat May 26 21:19:03 2012
@@ -18,19 +18,16 @@ package org.apache.commons.imaging.forma
 
 import org.apache.commons.imaging.formats.psd.ImageContents;
 
-public class DataParserStub extends DataParser
-{
+public class DataParserStub extends DataParser {
     @Override
     protected int getRGB(int data[][][], int x, int y,
-            ImageContents imageContents)
-    {
+            ImageContents imageContents) {
         return 0;
     }
 
     @Override
-    public int getBasicChannelsCount()
-    {
+    public int getBasicChannelsCount() {
         return 1;
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java Sat May 26 21:19:03 2012
@@ -30,41 +30,37 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
 import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
-public class CompressedDataReader extends DataReader
-{
+public class CompressedDataReader extends DataReader {
 
-    public CompressedDataReader(DataParser fDataParser)
-    {
+    public CompressedDataReader(DataParser fDataParser) {
         super(fDataParser);
     }
 
     @Override
     public void readData(InputStream is, BufferedImage bi,
             ImageContents imageContents, BinaryFileParser bfp)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         PsdHeaderInfo header = imageContents.header;
         int width = header.Columns;
         int height = header.Rows;
 
-        //                this.setDebug(true);
+        // this.setDebug(true);
         int scanline_count = height * header.Channels;
         int scanline_bytecounts[] = new int[scanline_count];
         for (int i = 0; i < scanline_count; i++)
             scanline_bytecounts[i] = bfp.read2Bytes("scanline_bytecount[" + i
                     + "]", is, "PSD: bad Image Data");
         bfp.setDebug(false);
-        //        System.out.println("fImageContents.Compression: "
-        //                + imageContents.Compression);
+        // System.out.println("fImageContents.Compression: "
+        // + imageContents.Compression);
 
         int depth = header.Depth;
 
         int channel_count = dataParser.getBasicChannelsCount();
         int data[][][] = new int[channel_count][height][];
-        //            channels[0] =
+        // channels[0] =
         for (int channel = 0; channel < channel_count; channel++)
-            for (int y = 0; y < height; y++)
-            {
+            for (int y = 0; y < height; y++) {
                 int index = channel * height + y;
                 byte packed[] = bfp.readByteArray("scanline",
                         scanline_bytecounts[index], is,
@@ -74,7 +70,13 @@ public class CompressedDataReader extend
                 InputStream bais = new ByteArrayInputStream(unpacked);
                 MyBitInputStream mbis = new MyBitInputStream(bais,
                         BYTE_ORDER_MSB);
-                BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8); // we want all samples to be bytes
+                BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8); // we
+                                                                                 // want
+                                                                                 // all
+                                                                                 // samples
+                                                                                 // to
+                                                                                 // be
+                                                                                 // bytes
                 int scanline[] = bbis.readBitsArray(depth, width);
                 data[channel][y] = scanline;
 
@@ -83,4 +85,4 @@ public class CompressedDataReader extend
         dataParser.parseData(data, bi, imageContents);
 
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/DataReader.java Sat May 26 21:19:03 2012
@@ -26,12 +26,10 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.formats.psd.ImageContents;
 import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
-public abstract class DataReader implements BinaryConstants
-{
+public abstract class DataReader implements BinaryConstants {
     protected final DataParser dataParser;
 
-    public DataReader(DataParser fDataParser)
-    {
+    public DataReader(DataParser fDataParser) {
         this.dataParser = fDataParser;
     }
 
@@ -39,8 +37,7 @@ public abstract class DataReader impleme
             ImageContents imageContents, BinaryFileParser bfp)
             throws ImageReadException, IOException;
 
-    public void dump()
-    {
+    public void dump() {
         dataParser.dump();
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java Sat May 26 21:19:03 2012
@@ -28,18 +28,15 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
 import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
 
-public class UncompressedDataReader extends DataReader
-{
-    public UncompressedDataReader(DataParser fDataParser)
-    {
+public class UncompressedDataReader extends DataReader {
+    public UncompressedDataReader(DataParser fDataParser) {
         super(fDataParser);
     }
 
     @Override
     public void readData(InputStream is, BufferedImage bi,
             ImageContents imageContents, BinaryFileParser bfp)
-            throws ImageReadException, IOException
-    {
+            throws ImageReadException, IOException {
         PsdHeaderInfo header = imageContents.header;
         int width = header.Columns;
         int height = header.Rows;
@@ -49,13 +46,18 @@ public class UncompressedDataReader exte
         int channel_count = dataParser.getBasicChannelsCount();
         int depth = header.Depth;
         MyBitInputStream mbis = new MyBitInputStream(is, BYTE_ORDER_MSB);
-        BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8); // we want all samples to be bytes
+        BitsToByteInputStream bbis = new BitsToByteInputStream(mbis, 8); // we
+                                                                         // want
+                                                                         // all
+                                                                         // samples
+                                                                         // to
+                                                                         // be
+                                                                         // bytes
 
         int data[][][] = new int[channel_count][height][width];
         for (int channel = 0; channel < channel_count; channel++)
             for (int y = 0; y < height; y++)
-                for (int x = 0; x < width; x++)
-                {
+                for (int x = 0; x < width; x++) {
                     int b = bbis.readBits(depth);
 
                     data[channel][y][x] = (byte) b;
@@ -64,4 +66,4 @@ public class UncompressedDataReader exte
         dataParser.parseData(data, bi, imageContents);
 
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/InfoHeaderReader.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/InfoHeaderReader.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/InfoHeaderReader.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/InfoHeaderReader.java Sat May 26 21:19:03 2012
@@ -22,14 +22,14 @@ import java.io.InputStream;
 class InfoHeaderReader {
     private final InputStream is;
 
-    public InfoHeaderReader( InputStream is ) {
+    public InfoHeaderReader(InputStream is) {
         this.is = is;
     }
 
     private char read() throws IOException {
         int result = is.read();
-        if ( result < 0 ) {
-            throw new IOException( "HDR: Unexpected EOF" );
+        if (result < 0) {
+            throw new IOException("HDR: Unexpected EOF");
         }
         return (char) result;
     }
@@ -38,10 +38,10 @@ class InfoHeaderReader {
         StringBuffer buffer = new StringBuffer();
         char c;
 
-        while ( ( c = read() ) != '\n' ) {
-            buffer.append( c );
+        while ((c = read()) != '\n') {
+            buffer.append(c);
         }
 
         return buffer.toString();
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeConstants.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeConstants.java Sat May 26 21:19:03 2012
@@ -18,5 +18,6 @@ package org.apache.commons.imaging.forma
 
 interface RgbeConstants {
     // #?RADIANCE
-    byte[] HEADER = new byte[]{ 0x23, 0x3F, 0x52, 0x41, 0x44, 0x49, 0x41, 0x4E, 0x43, 0x45 };
+    byte[] HEADER = new byte[] { 0x23, 0x3F, 0x52, 0x41, 0x44, 0x49, 0x41,
+            0x4E, 0x43, 0x45 };
 }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java Sat May 26 21:19:03 2012
@@ -40,14 +40,14 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.bytesource.ByteSource;
 
 /**
-* Parser for Radiance HDR images
-*
-* @author <a href="mailto:peter@electrotank.com">peter royal</a>
-*/
+ * Parser for Radiance HDR images
+ * 
+ * @author <a href="mailto:peter@electrotank.com">peter royal</a>
+ */
 public class RgbeImageParser extends ImageParser {
 
     public RgbeImageParser() {
-        setByteOrder( BinaryConstants.BYTE_ORDER_BIG_ENDIAN );
+        setByteOrder(BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
     }
 
     @Override
@@ -62,17 +62,18 @@ public class RgbeImageParser extends Ima
 
     @Override
     protected String[] getAcceptedExtensions() {
-        return new String[]{ ".hdr", ".pic" };
+        return new String[] { ".hdr", ".pic" };
     }
 
     @Override
     protected ImageFormat[] getAcceptedTypes() {
-        return new ImageFormat[]{ ImageFormat.IMAGE_FORMAT_RGBE };
+        return new ImageFormat[] { ImageFormat.IMAGE_FORMAT_RGBE };
     }
 
     @Override
-    public IImageMetadata getMetadata( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
-        RgbeInfo info = new RgbeInfo( byteSource );
+    public IImageMetadata getMetadata(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
+        RgbeInfo info = new RgbeInfo(byteSource);
 
         try {
             return info.getMetadata();
@@ -82,84 +83,73 @@ public class RgbeImageParser extends Ima
     }
 
     @Override
-    public ImageInfo getImageInfo( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
-        RgbeInfo info = new RgbeInfo( byteSource );
+    public ImageInfo getImageInfo(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
+        RgbeInfo info = new RgbeInfo(byteSource);
 
         try {
-            return new ImageInfo( getName(),
-                                  32, // todo may be 64 if double?
-                                  new ArrayList(),
-                                  ImageFormat.IMAGE_FORMAT_RGBE,
-                                  getName(),
-                                  info.getHeight(),
-                                  "image/vnd.radiance",
-                                  1,
-                                  -1,
-                                  -1,
-                                  -1,
-                                  -1,
-                                  info.getWidth(),
-                                  false,
-                                  false,
-                                  false,
-                                  ImageInfo.COLOR_TYPE_RGB,
-                                  "Adaptive RLE" );
+            return new ImageInfo(
+                    getName(),
+                    32, // todo may be 64 if double?
+                    new ArrayList(), ImageFormat.IMAGE_FORMAT_RGBE, getName(),
+                    info.getHeight(), "image/vnd.radiance", 1, -1, -1, -1, -1,
+                    info.getWidth(), false, false, false,
+                    ImageInfo.COLOR_TYPE_RGB, "Adaptive RLE");
         } finally {
             info.close();
         }
     }
 
     @Override
-    public BufferedImage getBufferedImage( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
-        RgbeInfo info = new RgbeInfo( byteSource );
+    public BufferedImage getBufferedImage(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
+        RgbeInfo info = new RgbeInfo(byteSource);
 
         try {
             // It is necessary to create our own BufferedImage here as the
-            // org.apache.sanselan.common.IBufferedImageFactory interface does not expose this complexity
-            DataBuffer buffer = new DataBufferFloat( info.getPixelData(), info.getWidth() * info.getHeight() );
-
-            return new BufferedImage(
-                new ComponentColorModel( ColorSpace.getInstance( ColorSpace.CS_sRGB ),
-                                         false,
-                                         false,
-                                         Transparency.OPAQUE,
-                                         buffer.getDataType() ),
-                Raster.createWritableRaster( new BandedSampleModel( buffer.getDataType(),
-                                                                    info.getWidth(),
-                                                                    info.getHeight(),
-                                                                    3 ),
-                                             buffer,
-                                             new Point() ),
-                false,
-                null );
+            // org.apache.sanselan.common.IBufferedImageFactory interface does
+            // not expose this complexity
+            DataBuffer buffer = new DataBufferFloat(info.getPixelData(),
+                    info.getWidth() * info.getHeight());
+
+            return new BufferedImage(new ComponentColorModel(
+                    ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false,
+                    Transparency.OPAQUE, buffer.getDataType()),
+                    Raster.createWritableRaster(
+                            new BandedSampleModel(buffer.getDataType(), info
+                                    .getWidth(), info.getHeight(), 3), buffer,
+                            new Point()), false, null);
         } finally {
             info.close();
         }
     }
 
     @Override
-    public Dimension getImageSize( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
-        RgbeInfo info = new RgbeInfo( byteSource );
+    public Dimension getImageSize(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
+        RgbeInfo info = new RgbeInfo(byteSource);
 
         try {
-            return new Dimension( info.getWidth(), info.getHeight() );
+            return new Dimension(info.getWidth(), info.getHeight());
         } finally {
             info.close();
         }
     }
 
     @Override
-    public byte[] getICCProfileBytes( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
+    public byte[] getICCProfileBytes(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
         return null;
     }
 
     @Override
-    public boolean embedICCProfile( File src, File dst, byte[] profile ) {
+    public boolean embedICCProfile(File src, File dst, byte[] profile) {
         return false;
     }
 
     @Override
-    public String getXmpXml( ByteSource byteSource, Map params ) throws ImageReadException, IOException {
+    public String getXmpXml(ByteSource byteSource, Map params)
+            throws ImageReadException, IOException {
         return null;
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeInfo.java Sat May 26 21:19:03 2012
@@ -31,20 +31,22 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.util.Debug;
 
 class RgbeInfo extends BinaryFileFunctions {
-    private static final Pattern RESOLUTION_STRING = Pattern.compile( "-Y (\\d+) \\+X (\\d+)" );
+    private static final Pattern RESOLUTION_STRING = Pattern
+            .compile("-Y (\\d+) \\+X (\\d+)");
 
     private final BinaryInputStream in;
     private ImageMetadata metadata;
     private int width = -1;
     private int height = -1;
-    private static final byte[] TWO_TWO = new byte[]{ 0x2, 0x2 };
+    private static final byte[] TWO_TWO = new byte[] { 0x2, 0x2 };
 
-    RgbeInfo( ByteSource byteSource ) throws IOException {
-        this.in = new BinaryInputStream( byteSource.getInputStream(), BinaryConstants.BYTE_ORDER_BIG_ENDIAN );
+    RgbeInfo(ByteSource byteSource) throws IOException {
+        this.in = new BinaryInputStream(byteSource.getInputStream(),
+                BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
     }
 
     IImageMetadata getMetadata() throws IOException, ImageReadException {
-        if ( null == metadata ) {
+        if (null == metadata) {
             readMetadata();
         }
 
@@ -52,7 +54,7 @@ class RgbeInfo extends BinaryFileFunctio
     }
 
     int getWidth() throws IOException, ImageReadException {
-        if ( -1 == width ) {
+        if (-1 == width) {
             readDimensions();
         }
 
@@ -60,7 +62,7 @@ class RgbeInfo extends BinaryFileFunctio
     }
 
     int getHeight() throws IOException, ImageReadException {
-        if ( -1 == height ) {
+        if (-1 == height) {
             readDimensions();
         }
 
@@ -70,57 +72,60 @@ class RgbeInfo extends BinaryFileFunctio
     void close() {
         try {
             in.close();
-        } catch( IOException e ) {
-            Debug.debug( e );
+        } catch (IOException e) {
+            Debug.debug(e);
         }
     }
 
     private void readDimensions() throws IOException, ImageReadException {
         getMetadata(); // Ensure we've read past this
 
-        InfoHeaderReader reader = new InfoHeaderReader( in );
+        InfoHeaderReader reader = new InfoHeaderReader(in);
         String resolution = reader.readLine();
-        Matcher matcher = RESOLUTION_STRING.matcher( resolution );
+        Matcher matcher = RESOLUTION_STRING.matcher(resolution);
 
-        if ( !matcher.matches() ) {
+        if (!matcher.matches()) {
             throw new ImageReadException(
-                "Invalid HDR resolution string. Only \"-Y N +X M\" is supported. Found \"" + resolution + "\"" );
+                    "Invalid HDR resolution string. Only \"-Y N +X M\" is supported. Found \""
+                            + resolution + "\"");
         }
 
-        height = Integer.parseInt( matcher.group( 1 ) );
-        width = Integer.parseInt( matcher.group( 2 ) );
+        height = Integer.parseInt(matcher.group(1));
+        width = Integer.parseInt(matcher.group(2));
     }
 
     private void readMetadata() throws IOException, ImageReadException {
-        in.readAndVerifyBytes( RgbeConstants.HEADER, "Not a valid HDR: Incorrect Header" );
+        in.readAndVerifyBytes(RgbeConstants.HEADER,
+                "Not a valid HDR: Incorrect Header");
 
-        InfoHeaderReader reader = new InfoHeaderReader( in );
+        InfoHeaderReader reader = new InfoHeaderReader(in);
 
-        if ( reader.readLine().length() != 0 ) {
-            throw new ImageReadException( "Not a valid HDR: Incorrect Header" );
+        if (reader.readLine().length() != 0) {
+            throw new ImageReadException("Not a valid HDR: Incorrect Header");
         }
 
         metadata = new ImageMetadata();
 
         String info = reader.readLine();
 
-        while ( info.length() != 0 ) {
-            int equals = info.indexOf( "=" );
+        while (info.length() != 0) {
+            int equals = info.indexOf("=");
 
-            if ( equals > 0 ) {
-                String variable = info.substring( 0, equals );
-                String value = info.substring( equals + 1 );
+            if (equals > 0) {
+                String variable = info.substring(0, equals);
+                String value = info.substring(equals + 1);
 
-                if ( "FORMAT".equals( value ) ) {
-                    if ( !"32-bit_rle_rgbe".equals( value ) ) {
+                if ("FORMAT".equals(value)) {
+                    if (!"32-bit_rle_rgbe".equals(value)) {
                         throw new ImageReadException(
-                            "Only 32-bit_rle_rgbe images are supported, trying to read " + value );
+                                "Only 32-bit_rle_rgbe images are supported, trying to read "
+                                        + value);
                     }
                 }
 
-                metadata.add( variable, value );
+                metadata.add(variable, value);
             } else {
-                metadata.add( "<command>", info );
+                metadata.add("<command>", info);
             }
 
             info = reader.readLine();
@@ -128,37 +133,43 @@ class RgbeInfo extends BinaryFileFunctio
     }
 
     public float[][] getPixelData() throws IOException, ImageReadException {
-        // Read into local variables to ensure that we have seeked into the file far enough
+        // Read into local variables to ensure that we have seeked into the file
+        // far enough
         int height = getHeight();
         int width = getWidth();
 
-        if ( width >= 32768 ) {
-            throw new ImageReadException( "Scan lines must be less than 32768 bytes long" );
+        if (width >= 32768) {
+            throw new ImageReadException(
+                    "Scan lines must be less than 32768 bytes long");
         }
 
-        byte[] scanLineBytes = convertShortToByteArray( width, BinaryConstants.BYTE_ORDER_BIG_ENDIAN );
+        byte[] scanLineBytes = convertShortToByteArray(width,
+                BinaryConstants.BYTE_ORDER_BIG_ENDIAN);
         byte[] rgbe = new byte[width * 4];
         float[][] out = new float[3][width * height];
 
-        for ( int i = 0; i < height; i++ ) {
-            in.readAndVerifyBytes( TWO_TWO, "Scan line " + i + " expected to start with 0x2 0x2" );
-            in.readAndVerifyBytes( scanLineBytes, "Scan line " + i + " length expected" );
+        for (int i = 0; i < height; i++) {
+            in.readAndVerifyBytes(TWO_TWO, "Scan line " + i
+                    + " expected to start with 0x2 0x2");
+            in.readAndVerifyBytes(scanLineBytes, "Scan line " + i
+                    + " length expected");
 
-            decompress( in, rgbe );
+            decompress(in, rgbe);
 
-            for ( int channel = 0; channel < 3; channel++ ) {
+            for (int channel = 0; channel < 3; channel++) {
                 int channelOffset = channel * width;
                 int eOffset = 3 * width;
 
-                for ( int p = 0; p < width; p++ ) {
+                for (int p = 0; p < width; p++) {
                     int mantissa = rgbe[p + eOffset] & 0xff;
                     int pos = p + i * width;
 
-                    if ( 0 == mantissa ) {
+                    if (0 == mantissa) {
                         out[channel][pos] = 0;
                     } else {
-                        float mult = (float) Math.pow( 2, mantissa - ( 128 + 8 ) );
-                        out[channel][pos] = ( ( rgbe[p + channelOffset] & 0xff ) + 0.5f ) * mult;
+                        float mult = (float) Math.pow(2, mantissa - (128 + 8));
+                        out[channel][pos] = ((rgbe[p + channelOffset] & 0xff) + 0.5f)
+                                * mult;
                     }
                 }
             }
@@ -167,24 +178,25 @@ class RgbeInfo extends BinaryFileFunctio
         return out;
     }
 
-    private static void decompress( InputStream in, byte[] out ) throws IOException {
+    private static void decompress(InputStream in, byte[] out)
+            throws IOException {
         int position = 0;
         int total = out.length;
 
-        while ( position < total ) {
+        while (position < total) {
             int n = in.read();
 
-            if ( n > 128 ) {
+            if (n > 128) {
                 int value = in.read();
 
-                for ( int i = 0; i < ( n & 0x7f ); i++ ) {
+                for (int i = 0; i < (n & 0x7f); i++) {
                     out[position++] = (byte) value;
                 }
             } else {
-                for ( int i = 0; i < n; i++ ) {
+                for (int i = 0; i < n; i++) {
                     out[position++] = (byte) in.read();
                 }
             }
         }
     }
-}
\ No newline at end of file
+}

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=1342971&r1=1342970&r2=1342971&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 Sat May 26 21:19:03 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.imaging.formats.tga;
 
-public interface TgaConstants
-{
+public interface TgaConstants {
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaImageParser.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaImageParser.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tga/TgaImageParser.java Sat May 26 21:19:03 2012
@@ -1,4 +1,5 @@
 package org.apache.commons.imaging.formats.tga;
+
 ///*
 // * Licensed to the Apache Software Foundation (ASF) under one or more
 // * contributor license agreements.  See the NOTICE file distributed with
@@ -247,4 +248,4 @@ package org.apache.commons.imaging.forma
 //        return false;
 //    }
 //
-//}
\ No newline at end of file
+// }

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/JpegImageData.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/JpegImageData.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/JpegImageData.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/JpegImageData.java Sat May 26 21:19:03 2012
@@ -17,17 +17,14 @@
 
 package org.apache.commons.imaging.formats.tiff;
 
-public class JpegImageData extends TiffElement.DataElement
-{
-    public JpegImageData(int offset, int length, final byte data[])
-    {
+public class JpegImageData extends TiffElement.DataElement {
+    public JpegImageData(int offset, int length, final byte data[]) {
         super(offset, length, data);
     }
 
     @Override
-    public String getElementDescription(boolean verbose)
-    {
+    public String getElementDescription(boolean verbose) {
         return "Jpeg image data: " + data.length + " bytes";
     }
 
-}
\ No newline at end of file
+}

Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/TiffContents.java Sat May 26 21:19:03 2012
@@ -24,32 +24,27 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
 import org.apache.commons.imaging.util.Debug;
 
-public class TiffContents
-{
+public class TiffContents {
     public final TiffHeader header;
     public final List<TiffDirectory> directories;
 
-    public TiffContents(TiffHeader tiffHeader, List<TiffDirectory> directories)
-    {
+    public TiffContents(TiffHeader tiffHeader, List<TiffDirectory> directories) {
         this.header = tiffHeader;
         this.directories = directories;
     }
 
-    public List<TiffElement> getElements() throws ImageReadException
-    {
+    public List<TiffElement> getElements() throws ImageReadException {
         List<TiffElement> result = new ArrayList<TiffElement>();
 
         result.add(header);
 
-        for (int i = 0; i < directories.size(); i++)
-        {
+        for (int i = 0; i < directories.size(); i++) {
             TiffDirectory directory = directories.get(i);
 
             result.add(directory);
 
             List<TiffField> fields = directory.entries;
-            for (int j = 0; j < fields.size(); j++)
-            {
+            for (int j = 0; j < fields.size(); j++) {
                 TiffField field = fields.get(j);
                 TiffElement oversizeValue = field.getOversizeValueElement();
                 if (null != oversizeValue)
@@ -65,10 +60,8 @@ public class TiffContents
         return result;
     }
 
-    public TiffField findField(TagInfo tag) throws ImageReadException
-    {
-        for (int i = 0; i < directories.size(); i++)
-        {
+    public TiffField findField(TagInfo tag) throws ImageReadException {
+        for (int i = 0; i < directories.size(); i++) {
             TiffDirectory directory = directories.get(i);
 
             TiffField field = directory.findField(tag);
@@ -79,15 +72,13 @@ public class TiffContents
         return null;
     }
 
-    public void dissect(boolean verbose) throws ImageReadException
-    {
+    public void dissect(boolean verbose) throws ImageReadException {
         List<TiffElement> elements = getElements();
 
         Collections.sort(elements, TiffElement.COMPARATOR);
 
         int lastEnd = 0;
-        for (int i = 0; i < elements.size(); i++)
-        {
+        for (int i = 0; i < elements.size(); i++) {
             TiffElement element = elements.get(i);
 
             if (element.offset > lastEnd)
@@ -99,8 +90,7 @@ public class TiffContents
                     + element.length + ", end: "
                     + (element.offset + element.length) + ": "
                     + element.getElementDescription(false));
-            if (verbose)
-            {
+            if (verbose) {
                 String verbosity = element.getElementDescription(true);
                 if (null != verbosity)
                     Debug.debug(verbosity);
@@ -112,4 +102,4 @@ public class TiffContents
         Debug.debug();
     }
 
-}
\ No newline at end of file
+}



Mime
View raw message