fop 0.94

org.apache.fop.image
Class AbstractFopImage

java.lang.Object
  extended by org.apache.fop.image.AbstractFopImage
All Implemented Interfaces:
FopImage
Direct Known Subclasses:
BmpImage, EmfImage, EPSImage, GifImage, ImageIOImage, JAIImage, JimiImage, JpegImage, XmlGraphicsCommonsImage, XMLImage

public abstract class AbstractFopImage
extends java.lang.Object
implements FopImage

Base class to implement the FopImage interface.

Author:
Eric SCHAEFFER, Modified by Eric Dalquist - 9/14/2001 - ebdalqui@mtu.edu
See Also:
FopImage

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.fop.image.FopImage
FopImage.ImageInfo
 
Field Summary
protected  byte[] bitmaps
          Image data (pixels, uncompressed).
protected  int bitsPerPixel
          Bits per pixel.
protected  java.awt.color.ColorSpace colorSpace
          Image color space (java.awt.color.ColorSpace).
protected  double dpiHorizontal
          Horizontal bitmap resolution (in dpi)
protected  double dpiVertical
          Vertical bitmap resolution (in dpi)
protected  int height
          Image height (in pixel).
protected  FopImage.ImageInfo imageInfo
          ImageReader object (to obtain image header informations).
protected  java.io.InputStream inputStream
          Image input stream.
protected  boolean invertImage
          Photoshop generated CMYK JPEGs are inverted.
protected  boolean isTransparent
          Image transparency.
protected  int loaded
          Keeps track of what has been loaded.
protected static org.apache.commons.logging.Log log
          logging instance
protected  byte[] raw
          Image data (undecoded, compressed, for image formats that can be embedded without decoding.
protected  java.awt.Color transparentColor
          Transparent color (java.awt.Color).
protected  int width
          Image width (in pixel).
 
Fields inherited from interface org.apache.fop.image.FopImage
BITMAP, DIMENSIONS, ORIGINAL_DATA
 
Constructor Summary
AbstractFopImage(FopImage.ImageInfo info)
          Constructor.
 
Method Summary
 byte[] getBitmaps()
          Return the image data (pixels, uncompressed).
 int getBitmapsSize()
          Return the image data size (number of bytes taken up by the uncompressed pixels).
 int getBitsPerPixel()
          Return the number of bits per pixel.
 java.awt.color.ColorSpace getColorSpace()
          Return the image color space.
 int getHeight()
          Returns the image height.
 double getHorizontalResolution()
           
 java.awt.color.ICC_Profile getICCProfile()
          Get ICC profile for this image.
 Length getIntrinsicAlignmentAdjust()
           
 int getIntrinsicHeight()
           
 int getIntrinsicWidth()
           
 java.lang.String getMimeType()
          Get the mime type for this image.
 java.lang.String getOriginalURI()
           
 byte[] getRessourceBytes()
          Return the original image data (compressed).
 int getRessourceBytesSize()
          Return the original image data size (compressed).
 byte[] getSoftMask()
          Get the soft mask.
 java.awt.Color getTransparentColor()
          Return the transparent color.
 double getVerticalResolution()
           
 int getWidth()
          Returns the image width.
 boolean hasSoftMask()
          Check if this image has a soft mask.
 boolean isInverted()
           
 boolean isTransparent()
          Return the image transparency.
 boolean load(int type)
          Load image data and initialize its properties.
protected  boolean loadBitmap()
          Load a bitmap array of the image.
protected  boolean loadDefaultOriginalData()
          Load the original image data.
protected  boolean loadDimensions()
          Load the dimensions of the image.
protected  boolean loadOriginalData()
          Load the original image data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
logging instance


loaded

protected int loaded
Keeps track of what has been loaded.


width

protected int width
Image width (in pixel).


height

protected int height
Image height (in pixel).


dpiHorizontal

protected double dpiHorizontal
Horizontal bitmap resolution (in dpi)


dpiVertical

protected double dpiVertical
Vertical bitmap resolution (in dpi)


inputStream

protected java.io.InputStream inputStream
Image input stream.


imageInfo

protected FopImage.ImageInfo imageInfo
ImageReader object (to obtain image header informations).


colorSpace

protected java.awt.color.ColorSpace colorSpace
Image color space (java.awt.color.ColorSpace).


bitsPerPixel

protected int bitsPerPixel
Bits per pixel.


bitmaps

protected byte[] bitmaps
Image data (pixels, uncompressed).


raw

protected byte[] raw
Image data (undecoded, compressed, for image formats that can be embedded without decoding.


isTransparent

protected boolean isTransparent
Image transparency.


transparentColor

protected java.awt.Color transparentColor
Transparent color (java.awt.Color).


invertImage

protected boolean invertImage
Photoshop generated CMYK JPEGs are inverted.

Constructor Detail

AbstractFopImage

public AbstractFopImage(FopImage.ImageInfo info)
Constructor. Construct a new FopImage object and initialize its default properties: The image data isn't kept in memory.

Parameters:
info - image information
Method Detail

getMimeType

public java.lang.String getMimeType()
Get the mime type for this image.

Specified by:
getMimeType in interface FopImage
Returns:
the mime type for the image

getOriginalURI

public java.lang.String getOriginalURI()
Specified by:
getOriginalURI in interface FopImage
Returns:
the original URI used to access this image.
See Also:
FopImage.getOriginalURI()

load

public boolean load(int type)
Load image data and initialize its properties.

Specified by:
load in interface FopImage
Parameters:
type - the type of loading to do
Returns:
true if the loading was successful

loadDimensions

protected boolean loadDimensions()
Load the dimensions of the image. All implementations should override this to get and return the dimensions.

Returns:
true if the loading was successful

loadBitmap

protected boolean loadBitmap()
Load a bitmap array of the image. If the renderer requires a bitmap image then the implementations should override this to load the bitmap.

Returns:
true if the loading was successful

loadOriginalData

protected boolean loadOriginalData()
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.

Returns:
true if the loading was successful

loadDefaultOriginalData

protected boolean loadDefaultOriginalData()
Load the original image data. This is generic code for use by any subclass that wants to use this from a loadOriginalData() implementation.

Returns:
true if the loading was successful

getWidth

public int getWidth()
Description copied from interface: FopImage
Returns the image width.

Specified by:
getWidth in interface FopImage
Returns:
the image width (in pixels)

getHeight

public int getHeight()
Description copied from interface: FopImage
Returns the image height.

Specified by:
getHeight in interface FopImage
Returns:
the image height (in pixels)

getIntrinsicWidth

public int getIntrinsicWidth()
Specified by:
getIntrinsicWidth in interface FopImage
Returns:
the intrinsic image width (in millipoints)
See Also:
FopImage.getIntrinsicWidth()

getIntrinsicHeight

public int getIntrinsicHeight()
Specified by:
getIntrinsicHeight in interface FopImage
Returns:
the intrinsic image width (in millipoints)
See Also:
FopImage.getIntrinsicHeight()

getIntrinsicAlignmentAdjust

public Length getIntrinsicAlignmentAdjust()
Specified by:
getIntrinsicAlignmentAdjust in interface FopImage
Returns:
the intrinsic alignment-adjust value or NULL if the image does not have one.
See Also:
FopImage.getIntrinsicAlignmentAdjust()

getHorizontalResolution

public double getHorizontalResolution()
Specified by:
getHorizontalResolution in interface FopImage
Returns:
the horizontal bitmap resolution (in dpi)
See Also:
FopImage.getHorizontalResolution()

getVerticalResolution

public double getVerticalResolution()
Specified by:
getVerticalResolution in interface FopImage
Returns:
the vertical bitmap resolution (in dpi)
See Also:
FopImage.getVerticalResolution()

getColorSpace

public java.awt.color.ColorSpace getColorSpace()
Return the image color space.

Specified by:
getColorSpace in interface FopImage
Returns:
the image color space (java.awt.color.ColorSpace)

getICCProfile

public java.awt.color.ICC_Profile getICCProfile()
Get ICC profile for this image.

Specified by:
getICCProfile in interface FopImage
Returns:
the icc profile or null if not applicable

getBitsPerPixel

public int getBitsPerPixel()
Return the number of bits per pixel.

Specified by:
getBitsPerPixel in interface FopImage
Returns:
number of bits per pixel

isTransparent

public boolean isTransparent()
Return the image transparency.

Specified by:
isTransparent in interface FopImage
Returns:
true if the image is transparent

hasSoftMask

public boolean hasSoftMask()
Check if this image has a soft mask.

Specified by:
hasSoftMask in interface FopImage
Returns:
true if the image also has a soft transparency mask

getSoftMask

public byte[] getSoftMask()
Get the soft mask. The soft mask should have the same bitdepth as the image data.

Specified by:
getSoftMask in interface FopImage
Returns:
the data array of soft mask values

getTransparentColor

public java.awt.Color getTransparentColor()
Return the transparent color.

Specified by:
getTransparentColor in interface FopImage
Returns:
the transparent color (java.awt.Color)

isInverted

public boolean isInverted()
Specified by:
isInverted in interface FopImage
Returns:
true for CMYK images generated by Adobe Photoshop

getBitmaps

public byte[] getBitmaps()
Return the image data (pixels, uncompressed).

Specified by:
getBitmaps in interface FopImage
Returns:
the image data

getBitmapsSize

public int getBitmapsSize()
Return the image data size (number of bytes taken up by the uncompressed pixels).

Specified by:
getBitmapsSize in interface FopImage
Returns:
the image data size

getRessourceBytes

public byte[] getRessourceBytes()
Return the original image data (compressed).

Specified by:
getRessourceBytes in interface FopImage
Returns:
the original image data

getRessourceBytesSize

public int getRessourceBytesSize()
Return the original image data size (compressed).

Specified by:
getRessourceBytesSize in interface FopImage
Returns:
the original image data size

fop 0.94

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.