]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
some cleanup of comments and code
authorKeiron Liddle <keiron@apache.org>
Thu, 14 Nov 2002 15:19:42 +0000 (15:19 +0000)
committerKeiron Liddle <keiron@apache.org>
Thu, 14 Nov 2002 15:19:42 +0000 (15:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195536 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
src/org/apache/fop/image/AbstractFopImage.java
src/org/apache/fop/image/BmpImage.java
src/org/apache/fop/image/EPSImage.java
src/org/apache/fop/image/FopImage.java
src/org/apache/fop/image/FopImageConsumer.java
src/org/apache/fop/image/GifImage.java
src/org/apache/fop/image/ImageCache.java
src/org/apache/fop/image/ImageFactory.java
src/org/apache/fop/image/JAIImage.java
src/org/apache/fop/image/JimiImage.java
src/org/apache/fop/image/JpegImage.java
src/org/apache/fop/image/analyser/SVGReader.java

index 3e3b3220d9215bd90d330a5ce365f00c395aa21b..e4cc9bbdbe44bb297be461abe98b65f512c93ec0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
@@ -8,15 +8,12 @@
 package org.apache.fop.image;
 
 // Java
-import java.net.URL;
 import java.awt.color.ColorSpace;
 import java.awt.color.ICC_Profile;
 import java.io.InputStream;
 
 // FOP
 import org.apache.fop.pdf.PDFColor;
-import org.apache.fop.image.analyser.ImageReaderFactory;
-import org.apache.fop.image.analyser.ImageReader;
 import org.apache.fop.fo.FOUserAgent;
 
 /**
@@ -26,17 +23,20 @@ import org.apache.fop.fo.FOUserAgent;
  * @see FopImage
  */
 public abstract class AbstractFopImage implements FopImage {
+    /**
+     * Keeps track of what has been loaded.
+     */
     protected int loaded = 0;
 
     /**
      * Image width (in pixel).
      */
-    protected int m_width = 0;
+    protected int width = 0;
 
     /**
      * Image height (in pixel).
      */
-    protected int m_height = 0;
+    protected int height = 0;
 
     /**
      * Image input stream.
@@ -51,32 +51,32 @@ public abstract class AbstractFopImage implements FopImage {
     /**
      * Image color space (java.awt.color.ColorSpace).
      */
-    protected ColorSpace m_colorSpace = null;
+    protected ColorSpace colorSpace = null;
 
     /**
      * Bits per pixel.
      */
-    protected int m_bitsPerPixel = 0;
+    protected int bitsPerPixel = 0;
 
     /**
      * Image data (uncompressed).
      */
-    protected byte[] m_bitmaps = null;
+    protected byte[] bitmaps = null;
 
     /**
      * Image data size.
      */
-    protected int m_bitmapsSize = 0;
+    protected int bitmapsSize = 0;
 
     /**
      * Image transparency.
      */
-    protected boolean m_isTransparent = false;
+    protected boolean isTransparent = false;
 
     /**
      * Transparent color (org.apache.fop.pdf.PDFColor).
      */
-    protected PDFColor m_transparentColor = null;
+    protected PDFColor transparentColor = null;
 
     /**
      * Constructor.
@@ -86,63 +86,94 @@ public abstract class AbstractFopImage implements FopImage {
      * <LI>image height
      * </UL>
      * The image data isn't kept in memory.
-     * @param input input stream
-     * imgReader ImageReader object
-     * @return a new FopImage object
+     * @param info image information
      */
     public AbstractFopImage(FopImage.ImageInfo info) {
         this.inputStream = info.inputStream;
         this.imageInfo = info;
-        if(this.imageInfo.width != -1) {
-            m_width = imageInfo.width;
-            m_height = imageInfo.height;
+        if (this.imageInfo.width != -1) {
+            width = imageInfo.width;
+            height = imageInfo.height;
             loaded = loaded | DIMENSIONS;
         }
     }
 
+    /**
+     * Get the mime type for this image.
+     *
+     * @return the mime type for the image
+     */
     public String getMimeType() {
         return imageInfo.mimeType;
     }
 
     /**
      * Load image data and initialize its properties.
+     *
+     * @param type the type of loading to do
+     * @param ua the user agent for handling logging etc.
+     * @return true if the loading was successful
      */
     public synchronized boolean load(int type, FOUserAgent ua) {
-        if((loaded & type) != 0) {
+        if ((loaded & type) != 0) {
             return true;
         }
         boolean success = true;
-        if(((type & DIMENSIONS) != 0) && ((loaded & DIMENSIONS) == 0)) {
+        if (((type & DIMENSIONS) != 0) && ((loaded & DIMENSIONS) == 0)) {
             success = success && loadDimensions(ua);
 
-            if(!success) {
+            if (!success) {
                 return false;
             }
             loaded = loaded | DIMENSIONS;
         }
-        if(((type & BITMAP) != 0) && ((loaded & BITMAP) == 0)) {
+        if (((type & BITMAP) != 0) && ((loaded & BITMAP) == 0)) {
             success = success && loadBitmap(ua);
-            if(success) {
+            if (success) {
                 loaded = loaded | BITMAP;
             }
         }
-        if(((type & ORIGINAL_DATA) != 0) && ((loaded & ORIGINAL_DATA) == 0)) {
+        if (((type & ORIGINAL_DATA) != 0) && ((loaded & ORIGINAL_DATA) == 0)) {
             success = success && loadOriginalData(ua);
-            if(success) {
+            if (success) {
                 loaded = loaded | ORIGINAL_DATA;
             }
         }
         return success;
     }
 
+    /**
+     * Load the dimensions of the image.
+     * All implementations should override this to get and
+     * return the dimensions.
+     *
+     * @param ua the user agent
+     * @return true if the loading was successful
+     */
     protected boolean loadDimensions(FOUserAgent ua) {
         return false;
     }
 
+    /**
+     * Load a bitmap array of the image.
+     * If the renderer requires a bitmap image then the
+     * implementations should override this to load the bitmap.
+     * 
+     * @param ua the user agent
+     * @return true if the loading was successful
+     */
     protected boolean loadBitmap(FOUserAgent ua) {
         return false;
     }
 
+    /**
+     * Load the original image data.
+     * In some cases the original data can be used by the renderer.
+     * This should load the data and any other associated information. 
+     *
+     * @param ua the user agent
+     * @return true if the loading was successful
+     */
     protected boolean loadOriginalData(FOUserAgent ua) {
         return false;
     }
@@ -152,7 +183,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the image width
      */
     public int getWidth() {
-        return this.m_width;
+        return this.width;
     }
 
     /**
@@ -160,7 +191,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the image height
      */
     public int getHeight() {
-        return this.m_height;
+        return this.height;
     }
 
     /**
@@ -168,11 +199,12 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the image color space (java.awt.color.ColorSpace)
      */
     public ColorSpace getColorSpace() {
-        return this.m_colorSpace;
+        return this.colorSpace;
     }
 
     /**
      * Get ICC profile for this image.
+     * @return the icc profile or null if not applicable
      */
     public ICC_Profile getICCProfile() {
         return null;
@@ -183,7 +215,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return number of bits per pixel
      */
     public int getBitsPerPixel() {
-        return this.m_bitsPerPixel;
+        return this.bitsPerPixel;
     }
 
     /**
@@ -191,13 +223,24 @@ public abstract class AbstractFopImage implements FopImage {
      * @return true if the image is transparent
      */
     public boolean isTransparent() {
-        return this.m_isTransparent;
+        return this.isTransparent;
     }
 
+    /**
+     * Check if this image has a soft mask.
+     *
+     * @return true if the image also has a soft transparency mask
+     */
     public boolean hasSoftMask() {
         return false;
     }
 
+    /**
+     * Get the soft mask.
+     * The soft mask should have the same bitdepth as the image data.
+     *
+     * @return the data array of soft mask values
+     */
     public byte[] getSoftMask() {
         return null;
     }
@@ -207,7 +250,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the transparent color (org.apache.fop.pdf.PDFColor)
      */
     public PDFColor getTransparentColor() {
-        return this.m_transparentColor;
+        return this.transparentColor;
     }
 
     /**
@@ -215,7 +258,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the image data
      */
     public byte[] getBitmaps() {
-        return this.m_bitmaps;
+        return this.bitmaps;
     }
 
     /**
@@ -223,7 +266,7 @@ public abstract class AbstractFopImage implements FopImage {
      * @return the image data size
      */
     public int getBitmapsSize() {
-        return this.m_bitmapsSize;
+        return this.bitmapsSize;
     }
 
     /**
index c6d17d8ff197d7262ea0392b3f065f71fa980b2a..ed80e357a6dd95edfd92ec3b2f82775020fd8897 100644 (file)
@@ -1,34 +1,44 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
 
-/**
- * FopImage object for BMP images.
- * @author Art WELCH
- * @see AbstractFopImage
- * @see FopImage
- */
-
 package org.apache.fop.image;
 
 // Java
-import java.net.URL;
-import java.io.InputStream;
 import java.io.IOException;
 import java.awt.color.ColorSpace;
 
 // FOP
-import org.apache.fop.image.analyser.ImageReader;
 import org.apache.fop.fo.FOUserAgent;
 
+/**
+ * Bitmap image.
+ * This supports loading a bitmap image into bitmap data.
+ *
+ * @author Art WELCH
+ * @see AbstractFopImage
+ * @see FopImage
+ */
 public class BmpImage extends AbstractFopImage {
-    public BmpImage(FopImage.ImageInfo imgReader) {
-        super(imgReader);
+    /**
+     * Create a bitmap image with the image data.
+     *
+     * @param imgInfo the image information
+     */
+    public BmpImage(FopImage.ImageInfo imgInfo) {
+        super(imgInfo);
     }
 
+    /**
+     * Load the bitmap.
+     * This laods the bitmap data from the bitmap image.
+     *
+     * @param ua the user agent
+     * @return true if it was loaded successfully
+     */
     protected boolean loadBitmap(FOUserAgent ua) {
         int wpos = 18;
         int hpos = 22; // offset positioning for w and height in  bmp files
@@ -39,10 +49,11 @@ public class BmpImage extends AbstractFopImage {
             boolean eof = false;
             while ((!eof) && (filepos < 54)) {
                 int input = inputStream.read();
-                if (input == -1)
+                if (input == -1) {
                     eof = true;
-                else
+                } else {
                     headermap[filepos++] = input;
+                }
             }
 
             if (headermap[28] == 4 || headermap[28] == 8) {
@@ -53,9 +64,9 @@ public class BmpImage extends AbstractFopImage {
                     int count2 = 2;
                     while (!eof && count2 >= -1) {
                         int input = inputStream.read();
-                        if (input == -1)
+                        if (input == -1) {
                             eof = true;
-                        else if (count2 >= 0) {
+                        else if (count2 >= 0) {
                             palette[countr * 3 + count2] =
                               (byte)(input & 0xFF);
                         }
@@ -73,27 +84,27 @@ public class BmpImage extends AbstractFopImage {
             return false;
         }
         // gets h & w from headermap
-        this.m_width = headermap[wpos] + headermap[wpos + 1] * 256 +
+        this.width = headermap[wpos] + headermap[wpos + 1] * 256 +
                        headermap[wpos + 2] * 256 * 256 +
                        headermap[wpos + 3] * 256 * 256 * 256;
-        this.m_height = headermap[hpos] + headermap[hpos + 1] * 256 +
+        this.height = headermap[hpos] + headermap[hpos + 1] * 256 +
                         headermap[hpos + 2] * 256 * 256 +
                         headermap[hpos + 3] * 256 * 256 * 256;
 
         int imagestart = headermap[10] + headermap[11] * 256 +
                          headermap[12] * 256 * 256 + headermap[13] * 256 * 256 * 256;
-        this.m_bitsPerPixel = headermap[28];
-        this.m_colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
+        this.bitsPerPixel = headermap[28];
+        this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
         int bytes = 0;
-        if (this.m_bitsPerPixel == 1)
-            bytes = (this.m_width + 7) / 8;
-        else if (this.m_bitsPerPixel == 24)
-            bytes = this.m_width * 3;
-        else if (this.m_bitsPerPixel == 4 || this.m_bitsPerPixel == 8)
-            bytes = this.m_width / (8 / this.m_bitsPerPixel);
+        if (this.bitsPerPixel == 1)
+            bytes = (this.width + 7) / 8;
+        else if (this.bitsPerPixel == 24)
+            bytes = this.width * 3;
+        else if (this.bitsPerPixel == 4 || this.bitsPerPixel == 8)
+            bytes = this.width / (8 / this.bitsPerPixel);
         else {
             ua.getLogger().error("Image (" + ""
-                                         + ") has " + this.m_bitsPerPixel
+                                         + ") has " + this.bitsPerPixel
                                          + " which is not a supported BMP format.");
             return false;
         }
@@ -103,10 +114,10 @@ public class BmpImage extends AbstractFopImage {
         }
 
         // Should take care of the ColorSpace and bitsPerPixel
-        this.m_bitmapsSize = this.m_width * this.m_height * 3;
-        this.m_bitmaps = new byte[this.m_bitmapsSize];
+        this.bitmapsSize = this.width * this.height * 3;
+        this.bitmaps = new byte[this.bitmapsSize];
 
-        int[] temp = new int[bytes * this.m_height];
+        int[] temp = new int[bytes * this.height];
         try {
             int input;
             int count = 0;
@@ -123,67 +134,67 @@ public class BmpImage extends AbstractFopImage {
             return false;
         }
 
-        for (int i = 0; i < this.m_height; i++) {
+        for (int i = 0; i < this.height; i++) {
             int x = 0;
             int j = 0;
             while (j < bytes) {
-                int p = temp[(this.m_height - i - 1) * bytes + j];
+                int p = temp[(this.height - i - 1) * bytes + j];
 
-                if (this.m_bitsPerPixel == 24 && x < this.m_width) {
+                if (this.bitsPerPixel == 24 && x < this.width) {
                     int countr = 2;
                     do {
-                        this.m_bitmaps[3 * (i * this.m_width + x) +
+                        this.bitmaps[3 * (i * this.width + x) +
                                        countr] =
-                                         (byte)(temp[(this.m_height - i - 1) *
+                                         (byte)(temp[(this.height - i - 1) *
                                                      bytes + j] & 0xFF);
                         j++;
                     } while (--countr >= 0)
                         ;
                     x++;
-                } else if (this.m_bitsPerPixel == 1) {
+                } else if (this.bitsPerPixel == 1) {
                     for (int countr = 0;
-                            countr < 8 && x < this.m_width; countr++) {
+                            countr < 8 && x < this.width; countr++) {
                         if ((p & 0x80) != 0) {
-                            this.m_bitmaps[3 *
-                                           (i * this.m_width + x)] = (byte) 0xFF;
-                            this.m_bitmaps[3 * (i * this.m_width + x) +
+                            this.bitmaps[3 *
+                                           (i * this.width + x)] = (byte) 0xFF;
+                            this.bitmaps[3 * (i * this.width + x) +
                                            1] = (byte) 0xFF;
-                            this.m_bitmaps[3 * (i * this.m_width + x) +
+                            this.bitmaps[3 * (i * this.width + x) +
                                            2] = (byte) 0xFF;
                         } else {
-                            this.m_bitmaps[3 *
-                                           (i * this.m_width + x)] = (byte) 0;
-                            this.m_bitmaps[3 * (i * this.m_width + x) +
+                            this.bitmaps[3 *
+                                           (i * this.width + x)] = (byte) 0;
+                            this.bitmaps[3 * (i * this.width + x) +
                                            1] = (byte) 0;
-                            this.m_bitmaps[3 * (i * this.m_width + x) +
+                            this.bitmaps[3 * (i * this.width + x) +
                                            2] = (byte) 0;
                         }
                         p <<= 1;
                         x++;
                     }
                     j++;
-                } else if (this.m_bitsPerPixel == 4) {
+                } else if (this.bitsPerPixel == 4) {
                     for (int countr = 0;
-                            countr < 2 && x < this.m_width; countr++) {
+                            countr < 2 && x < this.width; countr++) {
                         int pal = ((p & 0xF0) >> 4) * 3;
-                        this.m_bitmaps[3 * (i * this.m_width + x)] =
+                        this.bitmaps[3 * (i * this.width + x)] =
                           palette[pal];
-                        this.m_bitmaps[3 * (i * this.m_width + x) +
+                        this.bitmaps[3 * (i * this.width + x) +
                                        1] = palette[pal + 1];
-                        this.m_bitmaps[3 * (i * this.m_width + x) +
+                        this.bitmaps[3 * (i * this.width + x) +
                                        2] = palette[pal + 2];
                         p <<= 4;
                         x++;
                     }
                     j++;
-                } else if (this.m_bitsPerPixel == 8) {
-                    if (x < this.m_width) {
+                } else if (this.bitsPerPixel == 8) {
+                    if (x < this.width) {
                         p *= 3;
-                        this.m_bitmaps[3 * (i * this.m_width + x)] =
+                        this.bitmaps[3 * (i * this.width + x)] =
                           palette[p];
-                        this.m_bitmaps[3 * (i * this.m_width + x) +
+                        this.bitmaps[3 * (i * this.width + x) +
                                        1] = palette[p + 1];
-                        this.m_bitmaps[3 * (i * this.m_width + x) +
+                        this.bitmaps[3 * (i * this.width + x) +
                                        2] = palette[p + 2];
                         j++;
                         x++;
@@ -194,12 +205,14 @@ public class BmpImage extends AbstractFopImage {
             }
         }
 
-        // This seems really strange to me, but I noticed that JimiImage hardcodes
-        // m_bitsPerPixel to 8. If I do not do this Acrobat is unable to read the resultant PDF,
+        // This seems really strange to me, but I noticed that
+        // JimiImage hardcodes bitsPerPixel to 8. If I do not
+        // do this Acrobat is unable to read the resultant PDF,
         // so we will hardcode this...
-        this.m_bitsPerPixel = 8;
+        this.bitsPerPixel = 8;
 
         return true;
     }
 
 }
+
index b6d20755500278daafe2fcf8491818c986fafd91..f97ca91a7f646e8ebd25219cf4af05832346540e 100644 (file)
@@ -1,28 +1,18 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
 
 package org.apache.fop.image;
 
-// Java
-import java.net.URL;
-import java.net.URLConnection;
-import java.io.InputStream;
-import java.io.IOException;
-
-// FOP
-import org.apache.fop.apps.Driver;
-import org.apache.fop.image.analyser.ImageReader;
-import org.apache.fop.image.analyser.EPSReader;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
 
 /**
+ * EPS image handler.
+ * This handles the Encapulated PostScript images.
+ * It gets the dimensions and original data from the analyser.
+ *
  * @see AbstractFopImage
  * @see FopImage
  */
@@ -33,7 +23,28 @@ public class EPSImage extends AbstractFopImage {
     private EPSData epsData = null;
 
     /**
-     * Initialize docName and bounding box
+     * Create an EPS image with the image information.
+     *
+     * @param imgInfo the information containing the data and bounding box
+     */
+    public EPSImage(FopImage.ImageInfo imgInfo) {
+        super(imgInfo);
+        init("");
+        if (imgInfo.data instanceof EPSData) {
+            epsData = (EPSData) imgInfo.data;
+            bbox = new int[4];
+            bbox[0] = (int) epsData.bbox[0];
+            bbox[1] = (int) epsData.bbox[1];
+            bbox[2] = (int) epsData.bbox[2];
+            bbox[3] = (int) epsData.bbox[3];
+
+            loaded = loaded | ORIGINAL_DATA;
+        }
+    }
+
+    /**
+     * Initialize docName and bounding box.
+     * @param name the document name
      */
     private void init(String name) {
         bbox = new int[4];
@@ -47,6 +58,7 @@ public class EPSImage extends AbstractFopImage {
 
     /**
      * Return the name of the eps
+     * @return the name of the eps
      */
     public String getDocName() {
         return docName;
@@ -54,26 +66,17 @@ public class EPSImage extends AbstractFopImage {
 
     /**
      * Return the bounding box
+     * @return an int array containing the bounding box
      */
     public int[] getBBox() {
         return bbox;
     }
 
-    public EPSImage(FopImage.ImageInfo imgInfo) {
-        super(imgInfo);
-        init("");
-        if (imgInfo.data instanceof EPSData) {
-            epsData = (EPSData) imgInfo.data;
-            bbox = new int[4];
-            bbox[0] = (int) epsData.bbox[0];
-            bbox[1] = (int) epsData.bbox[1];
-            bbox[2] = (int) epsData.bbox[2];
-            bbox[3] = (int) epsData.bbox[3];
-
-            loaded = loaded | ORIGINAL_DATA;
-        }
-    }
-
+    /**
+     * Get the eps image.
+     *
+     * @return the original eps image data
+     */
     public byte[] getEPSImage() {
         if (epsData.epsFile == null) {
             //log.error("ERROR LOADING EXTERNAL EPS");
@@ -81,6 +84,9 @@ public class EPSImage extends AbstractFopImage {
         return epsData.epsFile;
     }
 
+    /**
+     * Data for EPS image.
+     */
     public static class EPSData {
         public long[] bbox;
         public boolean isAscii; // True if plain ascii eps file
index 229bec44ad3dd58f21fb9c2aef80e196a3f33892..27da2bb258c4f1d5e7388235542618f8e5a8e76a 100644 (file)
@@ -1,13 +1,10 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
 
-// Author:       Eric SCHAEFFER
-// Description:  represent an image object
-
 package org.apache.fop.image;
 
 import java.io.InputStream;
@@ -17,17 +14,43 @@ import java.awt.color.ICC_Profile;
 import org.apache.fop.pdf.PDFColor;
 import org.apache.fop.fo.FOUserAgent;
 
+/**
+ * Fop image interface for loading images.
+ *
+ * @author Eric SCHAEFFER
+ */
 public interface FopImage {
+    /**
+     * Flag for loading dimensions.
+     */
     public static final int DIMENSIONS = 1;
+
+    /**
+     * Flag for loading original data.
+     */
     public static final int ORIGINAL_DATA = 2;
+
+    /**
+     * Flag for loading bitmap data.
+     */
     public static final int BITMAP = 4;
 
+    /**
+     * Get the mime type of this image.
+     * This is used so that when reading from the image it knows
+     * what type of image it is.
+     *
+     * @return the mime type string
+     */
     public String getMimeType();
 
     /**
      * Load particular inforamtion for this image
      * This must be called before attempting to get
      * the information.
+     *
+     * @param type the type of loading required
+     * @param ua the user agent
      * @return boolean true if the information could be loaded
      */
     public boolean load(int type, FOUserAgent ua);
@@ -61,6 +84,10 @@ public interface FopImage {
     public byte[] getRessourceBytes();
     public int getRessourceBytesSize();
 
+    /**
+     * Image info class.
+     * Information loaded from analyser and passed to image object.
+     */
     public static class ImageInfo {
         public InputStream inputStream;
         public int width;
index b4ed55b91b874c082bddc3e37150ecf6d4336c2f..57f2dd276510c01d6a9a2c22559d7b4f0b08a344 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
index 31c6966272c06c0adea3d2d90357108080442234..2a96271f9c7f885492434515649523e4214e3b88 100644 (file)
@@ -8,12 +8,10 @@
 package org.apache.fop.image;
 
 // Java
-import java.net.URL;
 import java.awt.image.ImageProducer;
 import java.awt.image.ColorModel;
 import java.awt.image.IndexColorModel;
 import java.awt.color.ColorSpace;
-import java.io.InputStream;
 
 // FOP
 import org.apache.fop.pdf.PDFColor;
@@ -41,6 +39,9 @@ public class GifImage extends AbstractFopImage {
             //ip = (ImageProducer) inputStream.getContent();
             inputStream.close();
             inputStream = null;
+            if (ip == null) {
+                return false;
+            }
             FopImageConsumer consumer = new FopImageConsumer(ip);
             ip.startProduction(consumer);
 
@@ -50,8 +51,8 @@ public class GifImage extends AbstractFopImage {
                 Thread.sleep(500);
             }
 
-            this.m_height = consumer.getHeight();
-            this.m_width = consumer.getWidth();
+            this.height = consumer.getHeight();
+            this.width = consumer.getWidth();
 
             try {
                 tmpMap = consumer.getImage();
@@ -62,18 +63,18 @@ public class GifImage extends AbstractFopImage {
             }
 
             ColorModel cm = consumer.getColorModel();
-            this.m_bitsPerPixel = 8;
-            // this.m_bitsPerPixel = cm.getPixelSize();
-            this.m_colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
+            this.bitsPerPixel = 8;
+            // this.bitsPerPixel = cm.getPixelSize();
+            this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
             if (cm.hasAlpha()) {
                 int transparencyType = cm.getTransparency(); // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
                 if (transparencyType == java.awt.Transparency.OPAQUE) {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 } else if (transparencyType ==
                     java.awt.Transparency.BITMASK) {
                     if (cm instanceof IndexColorModel) {
                         IndexColorModel indexcm = (IndexColorModel) cm;
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                         byte[] alphas = new byte[indexcm.getMapSize()];
                         byte[] reds = new byte[indexcm.getMapSize()];
                         byte[] greens = new byte[indexcm.getMapSize()];
@@ -86,8 +87,8 @@ public class GifImage extends AbstractFopImage {
                                 i < indexcm.getMapSize();
                                 i++) {
                             if ((alphas[i] & 0xFF) == 0) {
-                                this.m_isTransparent = true;
-                                this.m_transparentColor = new PDFColor(
+                                this.isTransparent = true;
+                                this.transparentColor = new PDFColor(
                                                             (int)(reds[i] & 0xFF),
                                                             (int)(greens[i] & 0xFF),
                                                             (int)(blues[i] & 0xFF));
@@ -97,23 +98,23 @@ public class GifImage extends AbstractFopImage {
                     } else {
                         // TRANSLUCENT
                         /*
-                         * this.m_isTransparent = false;
-                         * for (int i = 0; i < this.m_width * this.m_height; i++) {
+                         * this.isTransparent = false;
+                         * for (int i = 0; i < this.width * this.height; i++) {
                          * if (cm.getAlpha(tmpMap[i]) == 0) {
-                         * this.m_isTransparent = true;
-                         * this.m_transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
+                         * this.isTransparent = true;
+                         * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
                          * break;
                          * }
                          * }
                          */
                         // use special API...
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                     }
                 } else {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 }
             } else {
-                this.m_isTransparent = false;
+                this.isTransparent = false;
             }
         } catch (Exception ex) {
             ua.getLogger().error("Error while loading image "
@@ -124,19 +125,19 @@ public class GifImage extends AbstractFopImage {
         }
 
         // Should take care of the ColorSpace and bitsPerPixel
-        this.m_bitmapsSize = this.m_width * this.m_height * 3;
-        this.m_bitmaps = new byte[this.m_bitmapsSize];
-        for (int i = 0; i < this.m_height; i++) {
-            for (int j = 0; j < this.m_width; j++) {
-                int p = tmpMap[i * this.m_width + j];
+        this.bitmapsSize = this.width * this.height * 3;
+        this.bitmaps = new byte[this.bitmapsSize];
+        for (int i = 0; i < this.height; i++) {
+            for (int j = 0; j < this.width; j++) {
+                int p = tmpMap[i * this.width + j];
                 int r = (p >> 16) & 0xFF;
                 int g = (p >> 8) & 0xFF;
                 int b = (p) & 0xFF;
-                this.m_bitmaps[3 * (i * this.m_width + j)] =
+                this.bitmaps[3 * (i * this.width + j)] =
                   (byte)(r & 0xFF);
-                this.m_bitmaps[3 * (i * this.m_width + j) + 1] =
+                this.bitmaps[3 * (i * this.width + j) + 1] =
                   (byte)(g & 0xFF);
-                this.m_bitmaps[3 * (i * this.m_width + j) + 2] =
+                this.bitmaps[3 * (i * this.width + j) + 2] =
                   (byte)(b & 0xFF);
             }
         }
index 073f23e47e1a83a6a5e7f9357a377c0b9d609a64..4e200d6d91ce7deaf4a8c8c6a90c4d9a5414c9e9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
@@ -10,10 +10,43 @@ package org.apache.fop.image;
 // FOP
 import org.apache.fop.fo.FOUserAgent;
 
+/**
+ * Image cache holder.
+ * This interface is used for caching images.
+ */
 public interface ImageCache {
+    /**
+     * Get an image from the cache.
+     *
+     * @param url the url and key for the image
+     * @param context the user agent context
+     */
     public FopImage getImage(String url, FOUserAgent context);
+
+    /**
+     * Release an image in the current context.
+     *
+     * @param url the url and key for the image
+     * @param context the user agent context
+     */
     public void releaseImage(String url, FOUserAgent context);
+
+    /**
+     * Invalidate image.
+     * If during loading this image is found to be invalid
+     * it will be invalidated to prevent further attempts at
+     * loading the image.
+     *
+     * @param url the url and key for the image
+     * @param context the user agent context
+     */
     public void invalidateImage(String url, FOUserAgent context);
+
+    /**
+     * Remove a context and handle all images in the context.
+     *
+     * @param context the user agent context
+     */
     public void removeContext(FOUserAgent context);
 }
 
index a4fc8c92c7aedd14a28fcc8ed62fd05102ff6469..e0e2ef866f7f6e579ffe8b7e87e6c650cc9f4cf9 100644 (file)
@@ -31,11 +31,6 @@ import org.apache.fop.fo.FOUserAgent;
 // Avalon
 import org.apache.avalon.framework.logger.Logger;
 
-/*
-handle context: base dir, logger, caching
-
- */
-
 /**
  * create FopImage objects (with a configuration file - not yet implemented).
  * @author Eric SCHAEFFER
@@ -46,10 +41,21 @@ public class ImageFactory {
 
     private ImageFactory() {}
 
+    /**
+     * Get static image factory instance.
+     *
+     * @return the image factory instance
+     */
     public static ImageFactory getInstance() {
         return factory;
     }
 
+    /**
+     * Get the url string from a wrapped url.
+     *
+     * @href the input wrapped url
+     * @return the raw url
+     */
     public static String getURL(String href) {
         /*
          * According to section 5.11 a <uri-specification> is:
@@ -79,6 +85,10 @@ public class ImageFactory {
      * If this returns null then the image could not be loaded
      * due to an error. Messages should be logged.
      * Before calling this the getURL(url) must be used.
+     *
+     * @param url the url for the image
+     * @param context the user agent context
+     * @return the fop image instance
      */
     public FopImage getImage(String url, FOUserAgent context) {
         return cache.getImage(url, context);
@@ -89,6 +99,9 @@ public class ImageFactory {
      * This can be used if the renderer has its own cache of
      * the image.
      * The image should then be put into the weak cache.
+     *
+     * @param url the url for the image 
+     * @param context the user agent context
      */
     public void releaseImage(String url, FOUserAgent context) {
         cache.releaseImage(url, context);
@@ -98,6 +111,11 @@ public class ImageFactory {
      * create an FopImage objects.
      * @param href image URL as a String
      * @return a new FopImage object
+     *
+     * @param href the url for the image 
+     * @param baseURL the base url
+     * @param ua the user agent context
+     * @return the fop image instance
      */
     protected static FopImage loadImage(String href, String baseURL,
                                         FOUserAgent ua) {
@@ -105,6 +123,10 @@ public class ImageFactory {
 
         InputStream imgIS = openStream(href, baseURL, ua);
 
+        if (imgIS == null) {
+            return null;
+        }
+
         // If not, check image type
         FopImage.ImageInfo imgInfo = null;
         try {
@@ -268,6 +290,10 @@ public class ImageFactory {
     }
 }
 
+/**
+ * Basic image cache.
+ * This keeps track of invalid images.
+ */
 class BasicImageCache implements ImageCache {
     Set invalid = Collections.synchronizedSet(new HashSet());
     Map contextStore = Collections.synchronizedMap(new HashMap());
index c4da068e6fb4d455cf88a1019c7d76ba7ebafa13..8a0fb0007f9d8c20d9953c2f0dac04d08813a40c 100644 (file)
@@ -7,11 +7,6 @@
 
 package org.apache.fop.image;
 
-// Java
-import java.net.URL;
-import java.io.InputStream;
-import java.io.InputStream;
-
 // AWT
 import java.awt.image.ColorModel;
 import java.awt.image.IndexColorModel;
@@ -48,26 +43,26 @@ public class JAIImage extends AbstractFopImage {
             inputStream.close();
             inputStream = null;
 
-            this.m_height = imageOp.getHeight();
-            this.m_width = imageOp.getWidth();
+            this.height = imageOp.getHeight();
+            this.width = imageOp.getWidth();
 
             ColorModel cm = imageOp.getColorModel();
-            this.m_bitsPerPixel = 8;
-            // this.m_bitsPerPixel = cm.getPixelSize();
-            this.m_colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
+            this.bitsPerPixel = 8;
+            // this.bitsPerPixel = cm.getPixelSize();
+            this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
 
             BufferedImage imageData = imageOp.getAsBufferedImage();
-            int[] tmpMap = imageData.getRGB(0, 0, this.m_width,
-                                            this.m_height, null, 0, this.m_width);
+            int[] tmpMap = imageData.getRGB(0, 0, this.width,
+                                            this.height, null, 0, this.width);
 
             if (cm.hasAlpha()) {
                 int transparencyType = cm.getTransparency(); // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
                 if (transparencyType == java.awt.Transparency.OPAQUE) {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 } else if (transparencyType ==
                     java.awt.Transparency.BITMASK) {
                     if (cm instanceof IndexColorModel) {
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                         byte[] alphas = new byte[
                                           ((IndexColorModel) cm).getMapSize()];
                         byte[] reds = new byte[
@@ -84,8 +79,8 @@ public class JAIImage extends AbstractFopImage {
                                 i < ((IndexColorModel) cm).getMapSize();
                                 i++) {
                             if ((alphas[i] & 0xFF) == 0) {
-                                this.m_isTransparent = true;
-                                this.m_transparentColor = new PDFColor(
+                                this.isTransparent = true;
+                                this.transparentColor = new PDFColor(
                                                             (int)(reds[i] & 0xFF),
                                                             (int)(greens[i] & 0xFF),
                                                             (int)(blues[i] & 0xFF));
@@ -95,39 +90,39 @@ public class JAIImage extends AbstractFopImage {
                     } else {
                         // TRANSLUCENT
                         /*
-                         * this.m_isTransparent = false;
-                         * for (int i = 0; i < this.m_width * this.m_height; i++) {
+                         * this.isTransparent = false;
+                         * for (int i = 0; i < this.width * this.height; i++) {
                          * if (cm.getAlpha(tmpMap[i]) == 0) {
-                         * this.m_isTransparent = true;
-                         * this.m_transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
+                         * this.isTransparent = true;
+                         * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
                          * break;
                          * }
                          * }
                          * // or use special API...
                          */
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                     }
                 } else {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 }
             } else {
-                this.m_isTransparent = false;
+                this.isTransparent = false;
             }
 
             // Should take care of the ColorSpace and bitsPerPixel
-            this.m_bitmapsSize = this.m_width * this.m_height * 3;
-            this.m_bitmaps = new byte[this.m_bitmapsSize];
-            for (int i = 0; i < this.m_height; i++) {
-                for (int j = 0; j < this.m_width; j++) {
-                    int p = tmpMap[i * this.m_width + j];
+            this.bitmapsSize = this.width * this.height * 3;
+            this.bitmaps = new byte[this.bitmapsSize];
+            for (int i = 0; i < this.height; i++) {
+                for (int j = 0; j < this.width; j++) {
+                    int p = tmpMap[i * this.width + j];
                     int r = (p >> 16) & 0xFF;
                     int g = (p >> 8) & 0xFF;
                     int b = (p) & 0xFF;
-                    this.m_bitmaps[3 * (i * this.m_width + j)] =
+                    this.bitmaps[3 * (i * this.width + j)] =
                       (byte)(r & 0xFF);
-                    this.m_bitmaps[3 * (i * this.m_width + j) + 1] =
+                    this.bitmaps[3 * (i * this.width + j) + 1] =
                       (byte)(g & 0xFF);
-                    this.m_bitmaps[3 * (i * this.m_width + j) + 2] =
+                    this.bitmaps[3 * (i * this.width + j) + 2] =
                       (byte)(b & 0xFF);
                 }
             }
index 8369ab66e62fecccf9123a5822b50978f32920c4..67d4b9bbeff58b92fedb5233e782e92fb80a35ee 100644 (file)
@@ -43,19 +43,19 @@ public class JimiImage extends AbstractFopImage {
     }
 
     protected boolean loadDimensions(FOUserAgent ua) {
-        if(this.m_bitmaps == null) {
+        if(this.bitmaps == null) {
             loadImage(ua.getLogger());
         }
 
-        return this.m_bitmaps != null;
+        return this.bitmaps != null;
     }
 
     protected boolean loadBitmap(FOUserAgent ua) {
-        if(this.m_bitmaps == null) {
+        if(this.bitmaps == null) {
             loadImage(ua.getLogger());
         }
 
-        return this.m_bitmaps != null;
+        return this.bitmaps != null;
     }
 
     protected void loadImage(Logger log) {
@@ -70,8 +70,8 @@ public class JimiImage extends AbstractFopImage {
             while (!consumer.isImageReady()) {
                 Thread.sleep(500);
             }
-            this.m_height = consumer.getHeight();
-            this.m_width = consumer.getWidth();
+            this.height = consumer.getHeight();
+            this.width = consumer.getWidth();
 
             inputStream.close();
             inputStream = null;
@@ -84,18 +84,18 @@ public class JimiImage extends AbstractFopImage {
             }
 
             ColorModel cm = consumer.getColorModel();
-            this.m_bitsPerPixel = 8;
-            // this.m_bitsPerPixel = cm.getPixelSize();
-            this.m_colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
+            this.bitsPerPixel = 8;
+            // this.bitsPerPixel = cm.getPixelSize();
+            this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
             if (cm.hasAlpha()) {
                 // java.awt.Transparency. BITMASK or OPAQUE or TRANSLUCENT
                 int transparencyType = cm.getTransparency();
                 if (transparencyType == java.awt.Transparency.OPAQUE) {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 } else if (transparencyType ==
                     java.awt.Transparency.BITMASK) {
                     if (cm instanceof IndexColorModel) {
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                         byte[] alphas = new byte[
                                           ((IndexColorModel) cm).getMapSize()];
                         byte[] reds = new byte[
@@ -112,8 +112,8 @@ public class JimiImage extends AbstractFopImage {
                                 i < ((IndexColorModel) cm).getMapSize();
                                 i++) {
                             if ((alphas[i] & 0xFF) == 0) {
-                                this.m_isTransparent = true;
-                                this.m_transparentColor = new PDFColor(
+                                this.isTransparent = true;
+                                this.transparentColor = new PDFColor(
                                                             (int)(reds[i] & 0xFF),
                                                             (int)(greens[i] & 0xFF),
                                                             (int)(blues[i] & 0xFF));
@@ -123,23 +123,23 @@ public class JimiImage extends AbstractFopImage {
                     } else {
                         // TRANSLUCENT
                         /*
-                         * this.m_isTransparent = false;
-                         * for (int i = 0; i < this.m_width * this.m_height; i++) {
+                         * this.isTransparent = false;
+                         * for (int i = 0; i < this.width * this.height; i++) {
                          * if (cm.getAlpha(tmpMap[i]) == 0) {
-                         * this.m_isTransparent = true;
-                         * this.m_transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
+                         * this.isTransparent = true;
+                         * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]), cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
                          * break;
                          * }
                          * }
                          */
                         // use special API...
-                        this.m_isTransparent = false;
+                        this.isTransparent = false;
                     }
                 } else {
-                    this.m_isTransparent = false;
+                    this.isTransparent = false;
                 }
             } else {
-                this.m_isTransparent = false;
+                this.isTransparent = false;
             }
         } catch (Throwable ex) {
             log.error("Error while loading image "
@@ -149,19 +149,19 @@ public class JimiImage extends AbstractFopImage {
 
 
         // Should take care of the ColorSpace and bitsPerPixel
-        this.m_bitmapsSize = this.m_width * this.m_height * 3;
-        this.m_bitmaps = new byte[this.m_bitmapsSize];
-        for (int i = 0; i < this.m_height; i++) {
-            for (int j = 0; j < this.m_width; j++) {
-                int p = tmpMap[i * this.m_width + j];
+        this.bitmapsSize = this.width * this.height * 3;
+        this.bitmaps = new byte[this.bitmapsSize];
+        for (int i = 0; i < this.height; i++) {
+            for (int j = 0; j < this.width; j++) {
+                int p = tmpMap[i * this.width + j];
                 int r = (p >> 16) & 0xFF;
                 int g = (p >> 8) & 0xFF;
                 int b = (p) & 0xFF;
-                this.m_bitmaps[3 * (i * this.m_width + j)] =
+                this.bitmaps[3 * (i * this.width + j)] =
                   (byte)(r & 0xFF);
-                this.m_bitmaps[3 * (i * this.m_width + j) + 1] =
+                this.bitmaps[3 * (i * this.width + j) + 1] =
                   (byte)(g & 0xFF);
-                this.m_bitmaps[3 * (i * this.m_width + j) + 2] =
+                this.bitmaps[3 * (i * this.width + j) + 2] =
                   (byte)(b & 0xFF);
             }
         }
index 5673b0015456597ac9d5ddd548820b7912ffedbc..34f22a9e114a89b0d222ad927c34e607565cc141 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
  * LICENSE file included with these sources.
  */
@@ -8,18 +8,11 @@
 package org.apache.fop.image;
 
 // Java
-import java.net.URL;
-import java.awt.image.ImageProducer;
-import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
 import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
 import java.awt.color.ColorSpace;
 import java.awt.color.ICC_Profile;
-import java.awt.color.ICC_ColorSpace;
 
 // FOP
-import org.apache.fop.image.analyser.ImageReader;
 import org.apache.fop.fo.FOUserAgent;
 
 /**
@@ -30,8 +23,8 @@ import org.apache.fop.fo.FOUserAgent;
  */
 public class JpegImage extends AbstractFopImage {
     private ICC_Profile iccProfile = null;
-    private boolean found_icc_profile = false;
-    private boolean found_dimensions = false;
+    private boolean foundICCProfile = false;
+    private boolean foundDimensions = false;
 
     /**
      * Create a jpeg image with the info.
@@ -53,59 +46,57 @@ public class JpegImage extends AbstractFopImage {
     protected boolean loadOriginalData(FOUserAgent ua) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ByteArrayOutputStream iccStream = new ByteArrayOutputStream();
-        InputStream inStream;
-        byte[] readBuf = new byte[4096];
-        int bytes_read;
         int index = 0;
         boolean cont = true;
 
         try {
-            inStream = inputStream;
-
-            while ((bytes_read = inStream.read(readBuf)) != -1) {
-                baos.write(readBuf, 0, bytes_read);
+            byte[] readBuf = new byte[4096];
+            int bytesRead;
+            while ((bytesRead = inputStream.read(readBuf)) != -1) {
+                baos.write(readBuf, 0, bytesRead);
             }
             inputStream.close();
             inputStream = null;
         } catch (java.io.IOException ex) {
-            ua.getLogger().error("Error while loading image " +
-                                         "" + " : " + ex.getClass() +
-                                         " - " + ex.getMessage(), ex);
+            ua.getLogger().error("Error while loading image "
+                                         + " : " + ex.getClass()
+                                         " - " + ex.getMessage(), ex);
             return false;
         }
 
-        this.m_bitmaps = baos.toByteArray();
-        this.m_bitsPerPixel = 8;
-        this.m_isTransparent = false;
+        this.bitmaps = baos.toByteArray();
+        this.bitsPerPixel = 8;
+        this.isTransparent = false;
 
-        if (this.m_bitmaps.length > (index + 2) &&
-                uByte(this.m_bitmaps[index]) == 255 &&
-                uByte(this.m_bitmaps[index + 1]) == 216) {
+        if (this.bitmaps.length > (index + 2)
+                && uByte(this.bitmaps[index]) == 255
+                && uByte(this.bitmaps[index + 1]) == 216) {
             index += 2;
 
-            while (index < this.m_bitmaps.length && cont) {
+            while (index < this.bitmaps.length && cont) {
                 //check to be sure this is the begining of a header
-                if (this.m_bitmaps.length > (index + 2) &&
-                        uByte(this.m_bitmaps[index]) == 255) {
+                if (this.bitmaps.length > (index + 2)
+                        && uByte(this.bitmaps[index]) == 255) {
 
-                    //192 or 194 are the header bytes that contain the jpeg width height and color depth.
-                    if (uByte(this.m_bitmaps[index + 1]) == 192 ||
-                            uByte(this.m_bitmaps[index + 1]) == 194) {
+                    //192 or 194 are the header bytes that contain
+                    // the jpeg width height and color depth.
+                    if (uByte(this.bitmaps[index + 1]) == 192
+                            || uByte(this.bitmaps[index + 1]) == 194) {
 
-                        this.m_height = calcBytes(this.m_bitmaps[index + 5],
-                                                  this.m_bitmaps[index + 6]);
-                        this.m_width = calcBytes(this.m_bitmaps[index + 7],
-                                                 this.m_bitmaps[index + 8]);
+                        this.height = calcBytes(this.bitmaps[index + 5],
+                                                  this.bitmaps[index + 6]);
+                        this.width = calcBytes(this.bitmaps[index + 7],
+                                                 this.bitmaps[index + 8]);
 
-                        if (this.m_bitmaps[index + 9] == 1) {
-                            this.m_colorSpace = ColorSpace.getInstance(
+                        if (this.bitmaps[index + 9] == 1) {
+                            this.colorSpace = ColorSpace.getInstance(
                               ColorSpace.CS_GRAY);
-                        } else if (this.m_bitmaps[index + 9] == 3) {
-                            this.m_colorSpace = ColorSpace.getInstance(
+                        } else if (this.bitmaps[index + 9] == 3) {
+                            this.colorSpace = ColorSpace.getInstance(
                               ColorSpace.CS_LINEAR_RGB);
-                        } else if (this.m_bitmaps[index + 9] == 4) {
+                        } else if (this.bitmaps[index + 9] == 4) {
                             // howto create CMYK color space
-                            this.m_colorSpace = ColorSpace.getInstance(
+                            this.colorSpace = ColorSpace.getInstance(
                               ColorSpace.CS_CIEXYZ);
                         } else {
                             ua.getLogger().error("Unknown ColorSpace for image: "
@@ -113,36 +104,36 @@ public class JpegImage extends AbstractFopImage {
                             return false;
                         }
 
-                        found_dimensions = true;
-                        if (found_icc_profile) {
+                        foundDimensions = true;
+                        if (foundICCProfile) {
                             cont = false;
                             break;
                         }
-                        index += calcBytes(this.m_bitmaps[index + 2],
-                                           this.m_bitmaps[index + 3]) + 2;
+                        index += calcBytes(this.bitmaps[index + 2],
+                                           this.bitmaps[index + 3]) + 2;
 
-                    } else if (uByte(this.m_bitmaps[index + 1]) ==
-                        226 && this.m_bitmaps.length > (index + 60)) {
+                    } else if (uByte(this.bitmaps[index + 1]) == 226
+                                   && this.bitmaps.length > (index + 60)) {
                         // Check if ICC profile
-                        byte[] icc_string = new byte[11];
-                        System.arraycopy(this.m_bitmaps, index + 4,
-                                         icc_string, 0, 11);
+                        byte[] iccString = new byte[11];
+                        System.arraycopy(this.bitmaps, index + 4,
+                                         iccString, 0, 11);
 
-                        if ("ICC_PROFILE".equals(new String(icc_string))) {
+                        if ("ICC_PROFILE".equals(new String(iccString))) {
                             int chunkSize = calcBytes(
-                                              this.m_bitmaps[index + 2],
-                                              this.m_bitmaps[index + 3]) + 2;
+                                              this.bitmaps[index + 2],
+                                              this.bitmaps[index + 3]) + 2;
 
-                            iccStream.write(this.m_bitmaps,
+                            iccStream.write(this.bitmaps,
                                             index + 18, chunkSize - 18);
 
                         }
 
-                        index += calcBytes(this.m_bitmaps[index + 2],
-                                           this.m_bitmaps[index + 3]) + 2;
+                        index += calcBytes(this.bitmaps[index + 2],
+                                           this.bitmaps[index + 3]) + 2;
                     } else {
-                        index += calcBytes(this.m_bitmaps[index + 2],
-                                           this.m_bitmaps[index + 3]) + 2;
+                        index += calcBytes(this.bitmaps[index + 2],
+                                           this.bitmaps[index + 3]) + 2;
                     }
 
                 } else {
@@ -170,7 +161,7 @@ public class JpegImage extends AbstractFopImage {
                 ua.getLogger().error("Invalid ICC profile: " + e, e);
                 return false;
             }
-        } else if(this.m_colorSpace == null) {
+        } else if (this.colorSpace == null) {
             ua.getLogger().error("ColorSpace not specified for JPEG image");
             return false;
         }
index 13fab2b85901fa1bfe37807fd9236a86914a84b7..72545904af341408e7b0a8aac7942249190bed92 100644 (file)
@@ -155,7 +155,7 @@ public class SVGReader implements ImageReader {
                 fis.mark(length + 1);
                 SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(
                         XMLImage.getParserName());
-                SVGDocument doc = (SVGDocument) factory.createDocument(uri, fis);
+                SVGDocument doc = (SVGDocument) factory.createSVGDocument(uri, fis);
                 info.data = doc;
 
                 Element e = doc.getRootElement();