public class ImageSupport extends Object
ImageSupport class provides methods, which are implemented
differently for Java 1.3 and for Java 1.4. These methods are implemented as
public static methods, which delegate to protected instance methods of
implementations of this abstract class.| Modifier | Constructor and Description |
|---|---|
protected |
ImageSupport()
Private constructor prevents instantiation
|
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
coerceData(BufferedImage image,
boolean isAlphaPremultiplied)
Forces the data to match the state specified in the
isAlphaPremultiplied variable. |
static void |
deregisterImageIOSpi()
Deregisters the GIF Image writer to be used depending on the Java
runtime from the ImageIO registry.
|
protected BufferedImage |
doCoerceData(BufferedImage image,
boolean isAlphaPremultiplied)
Forces the data to match the state specified in the
isAlphaPremultiplied variable. |
protected IIOMetadata[] |
doCreateGIFMetadata(Layer layer,
ImageWriter writer,
int numCol)
Do GIF preprocessing : Reduce colors according to the quality desired and
define metadata structures.
|
protected void |
doGetGIFMetaData(Layer layer,
ImageReader reader)
Interpret the GIF metadata of a GIF image stream.
|
protected ImageReaderSpi |
getCmykJpegImageReaderSpi()
Returns the
CMYKJPEGImageReaderSpi instance
associated with this support implementation. |
protected ImageWriterSpi |
getGIFImageWriterSpi()
Returns the
GifImageWriterSpi instance
associated with this support implementation. |
static void |
registerImageIOSpi()
Registers the GIF Image writer to be used depending on the Java
runtime to the ImageIO registry.
|
protected static int |
toIndex(IndexColorModel icm,
int rgb)
Gets the nearest matching color index for the given rgba color value.
|
public static BufferedImage coerceData(BufferedImage image, boolean isAlphaPremultiplied)
isAlphaPremultiplied variable. It may multiply or
divide the color raster data by alpha, or do nothing if the data is
in the correct state.
NOTE: Due to a bug in the DirectColorModel.coerceData
implementation of Java 1.3 we have to hack this in using the
implementation of Java 1.4 for the 1.3 version and delegating to the
library implementation for the 1.4 version.
image - The image to apply the alpha channel for.isAlphaPremultiplied - true if the alpha has been
premultiplied; false otherwise.image. Callers should not assume to get a
different image or even different raster data object.public static void registerImageIOSpi()
public static void deregisterImageIOSpi()
protected void doGetGIFMetaData(Layer layer, ImageReader reader) throws IOException
reader - The reader, which read the image dataIOException - if reading the meta data from the image fails.IllegalStateException - if the input source of the reader has not
been set.protected IIOMetadata[] doCreateGIFMetadata(Layer layer, ImageWriter writer, int numCol)
As a side effect the base image will be replaced by a reduced color one !
numCol - The number of colors for the GIF Imageprotected BufferedImage doCoerceData(BufferedImage image, boolean isAlphaPremultiplied)
isAlphaPremultiplied variable. It may multiply or
divide the color raster data by alpha, or do nothing if the data is
in the correct state.image - The image to apply the alpha channel for.isAlphaPremultiplied - true if the alpha has been
premultiplied; false otherwise.image.protected ImageWriterSpi getGIFImageWriterSpi()
GifImageWriterSpi instance
associated with this support implementation. The object returned may
be used for registration to the ImageIO registry of Writer SPIs.protected ImageReaderSpi getCmykJpegImageReaderSpi()
CMYKJPEGImageReaderSpi instance
associated with this support implementation. The object returned may
be used for registration to the ImageIO registry of Reader SPIs.protected static int toIndex(IndexColorModel icm, int rgb)
rgb is zero, the index for the
transparent color is returned.
This method's implementation can only handle color maps in the int, byte, or short transfer type format. For any other format, 0 is returned.
icm - The IndexColorModel containing the color maprgb - The ARGB color value to find in the color mapCopyright © 2011–2018 Adobe Systems Incorporated. All rights reserved.