com.crionics.jpdf.graphic
Class AbstractImage

java.lang.Object
  extended by com.crionics.jpdf.graphic.AbstractImage
Direct Known Subclasses:
ImageGeneric, ImageJPEG

public abstract class AbstractImage
extends java.lang.Object

Abstract Class containing the methods shared by the different Image Object Type.


Field Summary
static int FLIP_NONE
          No Flip.
static int FLIP_X
          Used when the image is to be flipped around the X Axis (Horizontal).
static int FLIP_XY
          Used when the image is to be flipped around the X and Y Axis.
static int FLIP_Y
          Used when the image is to be flipped around the Y Axis (Vertical).
static int SCALE_MODEL_AVERAGE
          Used when the image is being scaled with a Area Averaging Scaling Algorithm.
static int SCALE_MODEL_FAST
          Used when the image is being scaled with a Fast Scaling Algorithm.
static int SCALE_MODEL_SMOOTH
          Used when the image is being scaled with a Smooth Scaling Algorithm.
static int TYPE_GENERIC
          Identifies the Image Object as one based on a image recognized by the Java AWT API.
static int TYPE_JPEG
          Identifies the Image Object as one based on a JPEG image.
 
Constructor Summary
AbstractImage()
           
 
Method Summary
 AbstractImage convertTo(int imageType)
          Returns a new Image Object based this instance, and of the type requested.
 void ensureHasAlphaChannel()
           
 void flip(int axis)
          Flips the image using the specified Axis.
 void flush()
          Flushes all resources being used to cache optimization information.
 int getHeight()
          Returns the height in pixels of the image.
 java.awt.Image getImage()
          Returns the image without any transformations
 java.awt.image.BufferedImage getImageTransformed()
          Returns a copy of the image.
 java.awt.image.BufferedImage getImageTransformed(int type)
          Returns a copy of the image in the specified type.
abstract  int getType()
           
 int getWidth()
          Returns the width in pixels of the image.
 void scale(int width, int height, int ScalingModel)
          Scales the image to the specified new dimension, and using the requested Scaling algorithm (Images.SCALE_MODEL_...).
abstract  void writeToStream(java.io.OutputStream outStream)
          Writes the content of the image in the specified OutputStream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLIP_NONE

public static final int FLIP_NONE
No Flip.
see flip(int).

See Also:
Constant Field Values

FLIP_X

public static final int FLIP_X
Used when the image is to be flipped around the X Axis (Horizontal).
see flip(int).

See Also:
Constant Field Values

FLIP_XY

public static final int FLIP_XY
Used when the image is to be flipped around the X and Y Axis.
see flip(int).

See Also:
Constant Field Values

FLIP_Y

public static final int FLIP_Y
Used when the image is to be flipped around the Y Axis (Vertical).
see flip(int).

See Also:
Constant Field Values

SCALE_MODEL_AVERAGE

public static final int SCALE_MODEL_AVERAGE
Used when the image is being scaled with a Area Averaging Scaling Algorithm.
see scale(int,int,int).
Compromise between Processing Speed and Image Quality .

See Also:
Constant Field Values

SCALE_MODEL_FAST

public static final int SCALE_MODEL_FAST
Used when the image is being scaled with a Fast Scaling Algorithm.
see scale(int,int,int).
Fastest Processing Speed .

See Also:
Constant Field Values

SCALE_MODEL_SMOOTH

public static final int SCALE_MODEL_SMOOTH
Used when the image is being scaled with a Smooth Scaling Algorithm.
see scale(int,int,int).
Highest Image Quality .

See Also:
Constant Field Values

TYPE_GENERIC

public static final int TYPE_GENERIC
Identifies the Image Object as one based on a image recognized by the Java AWT API.
Returned by getType()

See Also:
Constant Field Values

TYPE_JPEG

public static final int TYPE_JPEG
Identifies the Image Object as one based on a JPEG image.
Returned by getType()
Note: This only happen if the jpeg image as a valid JFIF Header.

See Also:
Constant Field Values
Constructor Detail

AbstractImage

public AbstractImage()
Method Detail

convertTo

public AbstractImage convertTo(int imageType)
                        throws PdfException
Returns a new Image Object based this instance, and of the type requested.

Parameters:
imageType - The type of the Image Object (Images.TYPE_...).
Returns:
The converted Image Object.
Throws:
PdfException - If the image type is not recognized.

ensureHasAlphaChannel

public void ensureHasAlphaChannel()

flip

public void flip(int axis)
          throws PdfException
Flips the image using the specified Axis.

Parameters:
axis - The axis used for the flipping (AbstractImage.FLIP_X,AbstractImage.FLIP_Y,AbstractImage.FLIP_XY or AbstractImage.FLIP_NONE ).
Throws:
PdfException - if the axis value is not recognized.

flush

public void flush()
Flushes all resources being used to cache optimization information. The underlying pixel data is unaffected.


getHeight

public int getHeight()
Returns the height in pixels of the image.

Returns:
The Height of the image.

getImage

public java.awt.Image getImage()
Returns the image without any transformations

Returns:
the image without any transformations

getImageTransformed

public java.awt.image.BufferedImage getImageTransformed()
Returns a copy of the image.

Returns:
A BufferefImage containing a Copy of the image.

getImageTransformed

public java.awt.image.BufferedImage getImageTransformed(int type)
Returns a copy of the image in the specified type.

Parameters:
type - The type of the Image (One of the BufferedImage.TYPE_xx entry)
Returns:
A BufferefImage containing a Copy of the image.

getType

public abstract int getType()

getWidth

public int getWidth()
Returns the width in pixels of the image.

Returns:
The Width of the image.

scale

public void scale(int width,
                  int height,
                  int ScalingModel)
Scales the image to the specified new dimension, and using the requested Scaling algorithm (Images.SCALE_MODEL_...).

Parameters:
width - The new Width in Pixels.
height - The new Height in Pixels.
ScalingModel - The Scaling Algorithm to use (Images.SCALE_MODEL_...).

writeToStream

public abstract void writeToStream(java.io.OutputStream outStream)
                            throws java.io.IOException
Writes the content of the image in the specified OutputStream.

Parameters:
outStream - The OuputStream where to write the image
Throws:
java.io.IOException - If an error occurs while accessing the stream.


Copyright © 1999-2007 Crionics. All Rights Reserved.