com.crionics.jpdf.graphic
Class ImageConvertor

java.lang.Object
  extended by com.crionics.jpdf.graphic.ImageConvertor

public final class ImageConvertor
extends java.lang.Object

This class is a Facade to the different techniques to load Images in Java. Depending on the JDK version of use, different methods may prevail (MediaTracker, ImageIO, JAI, JPEGCodec..etc). This class takes care of the job for you and will pick the most appropriate method. By default, this class will support JPEG and GIF formats. JDK 1.4 and above adds support for PNG along with many other formats supported through the ImageIO plug-ins (TIFF, BMP, JPEG 2000..etc.) See https://jai-imageio.dev.java.net/ for more details about ImageIO plugins.


Method Summary
static ImageConvertor getInstance()
          singleton pattern, return a single instance on the object
 AbstractImage loadImage(java.io.File imageFile)
          Creates an image object from the specified File.
 AbstractImage loadImage(java.awt.Image image)
          Creates an image object from the specified AWT Image.
 AbstractImage loadImage(java.lang.String imageFilename)
          Creates an image object from the specified filename.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ImageConvertor getInstance()
singleton pattern, return a single instance on the object

Returns:
a single instance on the object

loadImage

public AbstractImage loadImage(java.io.File imageFile)
                        throws java.io.IOException
Creates an image object from the specified File.
Note: if available, the method uses ImageIO, ImageIO uses plugin to support new codecs.

Parameters:
imageFile - The Image File.
Returns:
The Image Object.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.

loadImage

public AbstractImage loadImage(java.awt.Image image)
Creates an image object from the specified AWT Image.
Note: The object returned will be an ImageGeneric.

Parameters:
image - The AWT Image.
Returns:
The Image Object.

loadImage

public AbstractImage loadImage(java.lang.String imageFilename)
                        throws java.io.IOException
Creates an image object from the specified filename.

Parameters:
imageFilename - The Image Filename.
Returns:
The Image Object.
Throws:
java.io.IOException - Raised if a problem occured while reading the file.


Copyright © 1999-2007 Crionics. All Rights Reserved.