aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/image/AbstractFopImage.java
diff options
context:
space:
mode:
authorTore Engvig <tore@apache.org>2001-07-30 20:29:35 +0000
committerTore Engvig <tore@apache.org>2001-07-30 20:29:35 +0000
commite0edd215721150e6c04ac49706622d6189cb0b42 (patch)
tree6b59b872d9c0e93f99316ea2f421209b71a97755 /src/org/apache/fop/image/AbstractFopImage.java
parenteb57915dec9bcd907e495595efac60dbf3579ad8 (diff)
downloadxmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.tar.gz
xmlgraphics-fop-e0edd215721150e6c04ac49706622d6189cb0b42.zip
Formatted code according to code standards.
Changed license to use short license. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/image/AbstractFopImage.java')
-rw-r--r--src/org/apache/fop/image/AbstractFopImage.java489
1 files changed, 252 insertions, 237 deletions
diff --git a/src/org/apache/fop/image/AbstractFopImage.java b/src/org/apache/fop/image/AbstractFopImage.java
index c5616e1fd..9617a7ca6 100644
--- a/src/org/apache/fop/image/AbstractFopImage.java
+++ b/src/org/apache/fop/image/AbstractFopImage.java
@@ -1,7 +1,8 @@
-/* $Id$
+/*
+ * $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
*/
package org.apache.fop.image;
@@ -23,241 +24,255 @@ import org.apache.fop.image.analyser.ImageReader;
* @see FopImage
*/
public abstract class AbstractFopImage implements FopImage {
- /**
- * Image width (in pixel).
- */
- protected int m_width = 0;
- /**
- * Image height (in pixel).
- */
- protected int m_height = 0;
- /**
- * Image URL.
- */
- protected URL m_href = null;
- /**
- * ImageReader object (to obtain image header informations).
- */
- protected ImageReader m_imageReader = null;
- /**
- * Image color space (org.apache.fop.datatypes.ColorSpace).
- */
- protected ColorSpace m_colorSpace = null;
- /**
- * Bits per pixel.
- */
- protected int m_bitsPerPixel = 0;
- /**
- * Image data (uncompressed).
- */
- protected byte[] m_bitmaps = null;
- /**
- * Image data size.
- */
- protected int m_bitmapsSize = 0;
- /**
- * Image transparency.
- */
- protected boolean m_isTransparent = false;
- /**
- * Transparent color (org.apache.fop.pdf.PDFColor).
- */
- protected PDFColor m_transparentColor = null;
-
- /**
- * Constructor.
- * Construct a new FopImage object and initialize its default properties:
- * <UL>
- * <LI>image width
- * <LI>image height
- * </UL>
- * The image data isn't kept in memory.
- * @param href image URL
- * @return a new FopImage object
- * @exception FopImageException an error occured during initialization
- */
- public AbstractFopImage(URL href) throws FopImageException {
- this.m_href = href;
- try {
- this.m_imageReader = ImageReaderFactory.Make(this.m_href.toExternalForm(), this.m_href.openStream());
- } catch (Exception e) {
- throw new FopImageException(e.getMessage());
+
+ /**
+ * Image width (in pixel).
+ */
+ protected int m_width = 0;
+
+ /**
+ * Image height (in pixel).
+ */
+ protected int m_height = 0;
+
+ /**
+ * Image URL.
+ */
+ protected URL m_href = null;
+
+ /**
+ * ImageReader object (to obtain image header informations).
+ */
+ protected ImageReader m_imageReader = null;
+
+ /**
+ * Image color space (org.apache.fop.datatypes.ColorSpace).
+ */
+ protected ColorSpace m_colorSpace = null;
+
+ /**
+ * Bits per pixel.
+ */
+ protected int m_bitsPerPixel = 0;
+
+ /**
+ * Image data (uncompressed).
+ */
+ protected byte[] m_bitmaps = null;
+
+ /**
+ * Image data size.
+ */
+ protected int m_bitmapsSize = 0;
+
+ /**
+ * Image transparency.
+ */
+ protected boolean m_isTransparent = false;
+
+ /**
+ * Transparent color (org.apache.fop.pdf.PDFColor).
+ */
+ protected PDFColor m_transparentColor = null;
+
+ /**
+ * Constructor.
+ * Construct a new FopImage object and initialize its default properties:
+ * <UL>
+ * <LI>image width
+ * <LI>image height
+ * </UL>
+ * The image data isn't kept in memory.
+ * @param href image URL
+ * @return a new FopImage object
+ * @exception FopImageException an error occured during initialization
+ */
+ public AbstractFopImage(URL href) throws FopImageException {
+ this.m_href = href;
+ try {
+ this.m_imageReader =
+ ImageReaderFactory.Make(this.m_href.toExternalForm(),
+ this.m_href.openStream());
+ } catch (Exception e) {
+ throw new FopImageException(e.getMessage());
+ }
+ this.m_width = this.m_imageReader.getWidth();
+ this.m_height = this.m_imageReader.getHeight();
+ }
+
+ /**
+ * Constructor.
+ * Construct a new FopImage object and initialize its default properties:
+ * <UL>
+ * <LI>image width
+ * <LI>image height
+ * </UL>
+ * The image data isn't kept in memory.
+ * @param href image URL
+ * imgReader ImageReader object
+ * @return a new FopImage object
+ * @exception FopImageException an error occured during initialization
+ */
+ public AbstractFopImage(URL href,
+ ImageReader imgReader) throws FopImageException {
+ this.m_href = href;
+ this.m_imageReader = imgReader;
+ this.m_width = this.m_imageReader.getWidth();
+ this.m_height = this.m_imageReader.getHeight();
+ }
+
+ /**
+ * Load image data and initialize its properties.
+ * Subclasses need to implement this method.
+ * @exception FopImageException an error occured during loading
+ */
+ abstract protected void loadImage() throws FopImageException;
+
+ /**
+ * Return the image URL.
+ * @return the image URL (as String)
+ */
+ public String getURL() {
+ return this.m_href.toString();
+ }
+
+ /**
+ * Return the image width.
+ * @return the image width
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public int getWidth() throws FopImageException {
+ if (this.m_width == 0)
+ this.loadImage();
+
+ return this.m_width;
+ }
+
+ /**
+ * Return the image height.
+ * @return the image height
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public int getHeight() throws FopImageException {
+ if (this.m_height == 0)
+ this.loadImage();
+
+ return this.m_height;
}
- this.m_width = this.m_imageReader.getWidth();
- this.m_height = this.m_imageReader.getHeight();
- }
-
- /**
- * Constructor.
- * Construct a new FopImage object and initialize its default properties:
- * <UL>
- * <LI>image width
- * <LI>image height
- * </UL>
- * The image data isn't kept in memory.
- * @param href image URL
- * imgReader ImageReader object
- * @return a new FopImage object
- * @exception FopImageException an error occured during initialization
- */
- public AbstractFopImage(URL href, ImageReader imgReader)
- throws FopImageException {
- this.m_href = href;
- this.m_imageReader = imgReader;
- this.m_width = this.m_imageReader.getWidth();
- this.m_height = this.m_imageReader.getHeight();
- }
-
- /**
- * Load image data and initialize its properties.
- * Subclasses need to implement this method.
- * @exception FopImageException an error occured during loading
- */
- abstract protected void loadImage() throws FopImageException;
-
- /**
- * Return the image URL.
- * @return the image URL (as String)
- */
- public String getURL() {
- return this.m_href.toString();
- }
-
- /**
- * Return the image width.
- * @return the image width
- * @exception FopImageException an error occured during property retriaval
- */
- public int getWidth() throws FopImageException {
- if (this.m_width == 0)
- this.loadImage();
-
- return this.m_width;
- }
-
- /**
- * Return the image height.
- * @return the image height
- * @exception FopImageException an error occured during property retriaval
- */
- public int getHeight() throws FopImageException {
- if (this.m_height == 0)
- this.loadImage();
-
- return this.m_height;
- }
-
- /**
- * Return the image color space.
- * @return the image color space (org.apache.fop.datatypes.ColorSpace)
- * @exception FopImageException an error occured during property retriaval
- */
- public ColorSpace getColorSpace() throws FopImageException {
- if (this.m_colorSpace == null)
- this.loadImage();
-
- return this.m_colorSpace;
- }
-
- /**
- * Return the number of bits per pixel.
- * @return number of bits per pixel
- * @exception FopImageException an error occured during property retriaval
- */
- public int getBitsPerPixel() throws FopImageException {
- if (this.m_bitsPerPixel == 0)
- this.loadImage();
-
- return this.m_bitsPerPixel;
- }
-
- /**
- * Return the image transparency.
- * @return true if the image is transparent
- * @exception FopImageException an error occured during property retriaval
- */
- public boolean isTransparent() throws FopImageException {
- return this.m_isTransparent;
- }
-
- /**
- * Return the transparent color.
- * @return the transparent color (org.apache.fop.pdf.PDFColor)
- * @exception FopImageException an error occured during property retriaval
- */
- public PDFColor getTransparentColor() throws FopImageException {
- return this.m_transparentColor;
- }
-
- /**
- * Return the image data (uncompressed).
- * @return the image data
- * @exception FopImageException an error occured during loading
- */
- public byte[] getBitmaps() throws FopImageException {
- if (this.m_bitmaps == null)
- this.loadImage();
-
- return this.m_bitmaps;
- }
-
- /**
- * Return the image data size (uncompressed).
- * @return the image data size
- * @exception FopImageException an error occured during loading
- */
- public int getBitmapsSize() throws FopImageException {
- if (this.m_bitmapsSize == 0)
- this.loadImage();
-
- return this.m_bitmapsSize;
- }
-
- /**
- * Return the original image data (compressed).
- * @return the original image data
- * @exception FopImageException an error occured during loading
- */
- public byte[] getRessourceBytes() throws FopImageException {
- return null;
- }
-
- /**
- * Return the original image data size (compressed).
- * @return the original image data size
- * @exception FopImageException an error occured during loading
- */
- public int getRessourceBytesSize() throws FopImageException {
- return 0;
- }
-
- /**
- * Return the original image compression type.
- * @return the original image compression type (org.apache.fop.pdf.PDFFilter)
- * @exception FopImageException an error occured during loading
- */
- public PDFFilter getPDFFilter() throws FopImageException {
- return null;
- }
-
- /**
- * Free all ressource.
- */
- public void close() {
- /* For the moment, only release the bitmaps (image areas
- can share the same FopImage object)
- Thus, even if it had been called, other properties
- are still available.
- */
- //this.m_width = 0;
- //this.m_height = 0;
- //this.m_href = null;
- //this.m_colorSpace = null;
- //this.m_bitsPerPixel = 0;
- this.m_bitmaps = null;
- this.m_bitmapsSize = 0;
- //this.m_isTransparent = false;
- //this.m_transparentColor = null;
- }
+
+ /**
+ * Return the image color space.
+ * @return the image color space (org.apache.fop.datatypes.ColorSpace)
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public ColorSpace getColorSpace() throws FopImageException {
+ if (this.m_colorSpace == null)
+ this.loadImage();
+
+ return this.m_colorSpace;
+ }
+
+ /**
+ * Return the number of bits per pixel.
+ * @return number of bits per pixel
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public int getBitsPerPixel() throws FopImageException {
+ if (this.m_bitsPerPixel == 0)
+ this.loadImage();
+
+ return this.m_bitsPerPixel;
+ }
+
+ /**
+ * Return the image transparency.
+ * @return true if the image is transparent
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public boolean isTransparent() throws FopImageException {
+ return this.m_isTransparent;
+ }
+
+ /**
+ * Return the transparent color.
+ * @return the transparent color (org.apache.fop.pdf.PDFColor)
+ * @exception FopImageException an error occured during property retriaval
+ */
+ public PDFColor getTransparentColor() throws FopImageException {
+ return this.m_transparentColor;
+ }
+
+ /**
+ * Return the image data (uncompressed).
+ * @return the image data
+ * @exception FopImageException an error occured during loading
+ */
+ public byte[] getBitmaps() throws FopImageException {
+ if (this.m_bitmaps == null)
+ this.loadImage();
+
+ return this.m_bitmaps;
+ }
+
+ /**
+ * Return the image data size (uncompressed).
+ * @return the image data size
+ * @exception FopImageException an error occured during loading
+ */
+ public int getBitmapsSize() throws FopImageException {
+ if (this.m_bitmapsSize == 0)
+ this.loadImage();
+
+ return this.m_bitmapsSize;
+ }
+
+ /**
+ * Return the original image data (compressed).
+ * @return the original image data
+ * @exception FopImageException an error occured during loading
+ */
+ public byte[] getRessourceBytes() throws FopImageException {
+ return null;
+ }
+
+ /**
+ * Return the original image data size (compressed).
+ * @return the original image data size
+ * @exception FopImageException an error occured during loading
+ */
+ public int getRessourceBytesSize() throws FopImageException {
+ return 0;
+ }
+
+ /**
+ * Return the original image compression type.
+ * @return the original image compression type (org.apache.fop.pdf.PDFFilter)
+ * @exception FopImageException an error occured during loading
+ */
+ public PDFFilter getPDFFilter() throws FopImageException {
+ return null;
+ }
+
+ /**
+ * Free all ressource.
+ */
+ public void close() {
+ /*
+ * For the moment, only release the bitmaps (image areas
+ * can share the same FopImage object)
+ * Thus, even if it had been called, other properties
+ * are still available.
+ */
+ // this.m_width = 0;
+ // this.m_height = 0;
+ // this.m_href = null;
+ // this.m_colorSpace = null;
+ // this.m_bitsPerPixel = 0;
+ this.m_bitmaps = null;
+ this.m_bitmapsSize = 0;
+ // this.m_isTransparent = false;
+ // this.m_transparentColor = null;
+ }
+
}