helma.image
Class ImageGenerator

java.lang.Object
  extended by helma.image.ImageGenerator
Direct Known Subclasses:
ImageIOGenerator, JimiGenerator

public abstract class ImageGenerator
extends java.lang.Object

Factory class for generating Image objects from various sources.


Field Summary
protected static ImageGenerator generator
           
 
Constructor Summary
ImageGenerator()
           
 
Method Summary
 ImageWrapper createImage(byte[] src)
           
 ImageWrapper createImage(ImageWrapper iw, java.awt.image.BufferedImageOp imageOp)
           
 ImageWrapper createImage(ImageWrapper iw, java.awt.image.ImageFilter filter)
           
 ImageWrapper createImage(java.io.InputStream input)
           
 ImageWrapper createImage(int w, int h)
           
 ImageWrapper createImage(java.lang.String filenamne)
           
 ImageWrapper createImage(java.net.URL url)
           
static ImageGenerator getInstance()
          Returns an ImageGenerator singleton, creating it if necessary.
 java.awt.Image read(byte[] src)
           
 java.awt.Image read(java.io.InputStream input)
           
 java.awt.Image read(java.lang.String filename)
           
 java.awt.Image read(java.net.URL url)
           
abstract  void write(ImageWrapper wrapper, java.io.OutputStream out, java.lang.String type, float quality, boolean alpha)
          Saves the image.
abstract  void write(ImageWrapper wrapper, java.lang.String filename, float quality, boolean alpha)
          Saves the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generator

protected static ImageGenerator generator
Constructor Detail

ImageGenerator

public ImageGenerator()
Method Detail

getInstance

public static ImageGenerator getInstance()
Returns an ImageGenerator singleton, creating it if necessary. If the JIMI package is installed, an instance of JimiGenerator will be returned. Otherwise, if the javax.imageio package is available, an instance of ImageIOGenerator is returned. Additionally, the class of the ImageGenerator implementation to be used can be set using the imageGenerator property in either the app.properties or server.properties file.

Returns:
a new ImageGenerator instance

createImage

public ImageWrapper createImage(int w,
                                int h)
Parameters:
w - ...
h - ...
Returns:
...

createImage

public ImageWrapper createImage(byte[] src)
                         throws java.io.IOException
Parameters:
src - ...
Returns:
...
Throws:
java.io.IOException

createImage

public ImageWrapper createImage(java.lang.String filenamne)
                         throws java.io.IOException
Parameters:
filenamne - ...
Returns:
...
Throws:
java.io.IOException

createImage

public ImageWrapper createImage(java.net.URL url)
                         throws java.net.MalformedURLException,
                                java.io.IOException
Parameters:
url - ...
Returns:
...
Throws:
java.net.MalformedURLException
java.io.IOException

createImage

public ImageWrapper createImage(java.io.InputStream input)
                         throws java.io.IOException
Parameters:
input - ...
Returns:
...
Throws:
java.io.IOException

createImage

public ImageWrapper createImage(ImageWrapper iw,
                                java.awt.image.ImageFilter filter)
Parameters:
iw - ...
filter - ...
Returns:
...

createImage

public ImageWrapper createImage(ImageWrapper iw,
                                java.awt.image.BufferedImageOp imageOp)
Parameters:
iw - ...
imageOp - ...
Returns:
...

read

public java.awt.Image read(java.lang.String filename)
                    throws java.io.IOException
Parameters:
filename - the filename of the image to create
Returns:
the newly created image
Throws:
java.io.IOException

read

public java.awt.Image read(java.net.URL url)
                    throws java.io.IOException
Parameters:
url - the URL of the image to create
Returns:
the newly created image
Throws:
java.io.IOException

read

public java.awt.Image read(byte[] src)
                    throws java.io.IOException
Parameters:
src - the data of the image to create
Returns:
the newly created image
Throws:
java.io.IOException

read

public java.awt.Image read(java.io.InputStream input)
                    throws java.io.IOException
Parameters:
input - the data of the image to create
Returns:
the newly created image
Throws:
java.io.IOException

write

public abstract void write(ImageWrapper wrapper,
                           java.lang.String filename,
                           float quality,
                           boolean alpha)
                    throws java.io.IOException
Saves the image. Image format is deduced from filename.

Parameters:
wrapper -
filename -
quality -
alpha -
Throws:
java.io.IOException

write

public abstract void write(ImageWrapper wrapper,
                           java.io.OutputStream out,
                           java.lang.String type,
                           float quality,
                           boolean alpha)
                    throws java.io.IOException
Saves the image. Image format is deduced from the dataSource.

Parameters:
wrapper -
out -
quality -
alpha -
Throws:
java.io.IOException


Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.