org.apache.fop.image

Class AbstractFopImage

Implemented Interfaces:
FopImage
Known Direct 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.
Authors:
Eric SCHAEFFER
Modified by Eric Dalquist - 9/14/2001 - ebdalqui@mtu.edu
See Also:
FopImage

Field Summary

protected byte[]
bitmaps
Image data (pixels, uncompressed).
protected int
bitsPerPixel
Bits per pixel.
protected 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 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 Log
log
logging instance
protected byte[]
raw
Image data (undecoded, compressed, for image formats that can be embedded without decoding.
protected 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.
ColorSpace
getColorSpace()
Return the image color space.
int
getHeight()
double
getHorizontalResolution()
ICC_Profile
getICCProfile()
Get ICC profile for this image.
Length
getIntrinsicAlignmentAdjust()
int
getIntrinsicHeight()
int
getIntrinsicWidth()
String
getMimeType()
Get the mime type for this image.
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.
Color
getTransparentColor()
Return the transparent color.
double
getVerticalResolution()
int
getWidth()
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.

Field Details

bitmaps

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

bitsPerPixel

protected int bitsPerPixel
Bits per pixel.

colorSpace

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

dpiHorizontal

protected double dpiHorizontal
Horizontal bitmap resolution (in dpi)

dpiVertical

protected double dpiVertical
Vertical bitmap resolution (in dpi)

height

protected int height
Image height (in pixel).

imageInfo

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

inputStream

protected InputStream inputStream
Image input stream.

invertImage

protected boolean invertImage
Photoshop generated CMYK JPEGs are inverted.

isTransparent

protected boolean isTransparent
Image transparency.

loaded

protected int loaded
Keeps track of what has been loaded.

log

protected static Log log
logging instance

raw

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

transparentColor

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

width

protected int width
Image width (in pixel).

Constructor Details

AbstractFopImage

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

Method Details

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

getBitsPerPixel

public int getBitsPerPixel()
Return the number of bits per pixel.
Specified by:
getBitsPerPixel in interface FopImage
Returns:
number of bits per pixel

getColorSpace

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

getHeight

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

getHorizontalResolution

public double getHorizontalResolution()
Specified by:
getHorizontalResolution in interface FopImage

getICCProfile

public ICC_Profile getICCProfile()
Get ICC profile for this image.
Specified by:
getICCProfile in interface FopImage
Returns:
the icc profile or null if not applicable

getIntrinsicAlignmentAdjust

public Length getIntrinsicAlignmentAdjust()
Specified by:
getIntrinsicAlignmentAdjust in interface FopImage

getIntrinsicHeight

public int getIntrinsicHeight()
Specified by:
getIntrinsicHeight in interface FopImage

getIntrinsicWidth

public int getIntrinsicWidth()
Specified by:
getIntrinsicWidth in interface FopImage

getMimeType

public String getMimeType()
Get the mime type for this image.
Specified by:
getMimeType in interface FopImage
Returns:
the mime type for the image

getOriginalURI

public String getOriginalURI()
Specified by:
getOriginalURI in interface FopImage

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

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 Color getTransparentColor()
Return the transparent color.
Specified by:
getTransparentColor in interface FopImage
Returns:
the transparent color (java.awt.Color)

getVerticalResolution

public double getVerticalResolution()
Specified by:
getVerticalResolution in interface FopImage

getWidth

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

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

isInverted

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

isTransparent

public boolean isTransparent()
Return the image transparency.
Specified by:
isTransparent in interface FopImage
Returns:
true if the image is transparent

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

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

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

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

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

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