com.davisor.graphics
Class ImageFactory
java.lang.Object
com.davisor.graphics.ImageFactory
- All Implemented Interfaces:
- ImageParams
- public class ImageFactory
- extends java.lang.Object
- implements ImageParams
ImageFactory implements a simple run-time configurable Java
BufferedImage generator that supports ImageParams image parameters.
|
Method Summary |
static java.awt.image.BufferedImage |
createBufferedImage(int width,
int height,
java.lang.String imageParams)
Creates a BufferedImage of specified size and type. |
static void |
releaseBufferedImage(java.awt.image.BufferedImage image)
Donates given image for later re-use. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COLORTYPE
public static final ColorType COLORTYPE
- ColorType for creating transparent colors.
ImageFactory
public ImageFactory()
createBufferedImage
public static java.awt.image.BufferedImage createBufferedImage(int width,
int height,
java.lang.String imageParams)
- Creates a BufferedImage of specified size and type. In
particular,
imageParams argument is expected to
contain space separated ImageParams compatible
name=value pairs:
| name |
value |
Description |
| type |
truecolor |
Creates a BufferedImage.TYPE_INT_ARGB image. |
| palette |
Creates a BufferedImage.TYPE_BYTE_INDEXED image
with a default 6x6x6+40 palette (see below).
|
| transparent |
ColorType.toData(java.lang.String, java.text.ParsePosition) color string |
Specifies a transparent palette color. In order to have any
effect, the color has to be one of the colors in the default
palette.
|
If image type is not specified, it defaults to
truecolor.
Palette details
The default palette contains a 6x6x6 color cube with 40 additional
shades of gray. In particular, color indexes 0 (black) - 215 (white)
contain all 8 bit combinations of RGB element values multiple of 51:
Color indexes 216 (dark) - 255 (light) contain 8 bit RGB
shades of gray, starting from element value 18 and continuing
with increments of 6 up to 252.
- Parameters:
width - image width in pixelsheight - image height in pixelsimageParams - image properties- See Also:
releaseBufferedImage(java.awt.image.BufferedImage)
releaseBufferedImage
public static void releaseBufferedImage(java.awt.image.BufferedImage image)
- Donates given image for later re-use. After calling this method,
the image must not be used by the caller in any way anymore. In
particular, the caller must be very carefull not to leave any
static or other references to the image around.
Once an image has been released, the image factory may re-use it
if someone later requests exactly the same kind of image by
calling createBufferedImage(int, int, java.lang.String). Alternatively, the image
may be thrown away at some time in the future, in which case it
will eventually be claimed by the garbage collector.
- Parameters:
image - image to be donated for later re-use- See Also:
createBufferedImage(int, int, java.lang.String)
Copyright © 2001-2004 Davisor Oy. All Rights Reserved.