org.apache.xmlgraphics.ps
public class ImageEncodingHelper extends java.lang.Object
Constructor and Description |
---|
ImageEncodingHelper(java.awt.image.RenderedImage image)
Main constructor
|
Modifier and Type | Method and Description |
---|---|
static ImageEncoder |
createRenderedImageEncoder(java.awt.image.RenderedImage img)
Create an ImageEncoder for the given RenderImage instance.
|
protected void |
determineEncodedColorModel()
Determines the color model used for encoding the image.
|
void |
encode(java.io.OutputStream out)
Encodes the image and writes everything to the given OutputStream.
|
void |
encodeAlpha(java.io.OutputStream out)
Encodes the image's alpha channel.
|
static void |
encodePackedColorComponents(java.awt.image.RenderedImage image,
java.io.OutputStream out)
Writes all pixels (color components only) of a RenderedImage to an OutputStream.
|
static void |
encodeRenderedImageAsRGB(java.awt.image.RenderedImage image,
java.io.OutputStream out)
Writes a RenderedImage to an OutputStream by converting it to RGB.
|
java.awt.image.ColorModel |
getEncodedColorModel()
Returns the effective
ColorModel used to encode the image. |
java.awt.image.RenderedImage |
getImage()
Returns the associated image.
|
java.awt.image.ColorModel |
getNativeColorModel()
Returns the native
ColorModel used by the image. |
boolean |
hasAlpha()
Indicates whether the image has an alpha channel.
|
boolean |
isConverted()
Indicates whether the image is converted during encodation.
|
protected boolean |
isMultiTile()
Indicates whether the image consists of multiple tiles.
|
public ImageEncodingHelper(java.awt.image.RenderedImage image)
image
- the imagepublic java.awt.image.RenderedImage getImage()
public java.awt.image.ColorModel getNativeColorModel()
ColorModel
used by the image.public java.awt.image.ColorModel getEncodedColorModel()
ColorModel
used to encode the image. If this is different
from the value returned by getNativeColorModel()
this means that the image
is converted in order to encode it because no native encoding is currently possible.public boolean hasAlpha()
public boolean isConverted()
public static void encodeRenderedImageAsRGB(java.awt.image.RenderedImage image, java.io.OutputStream out) throws java.io.IOException
image
- the imageout
- the OutputStream to write the pixels tojava.io.IOException
- if an I/O error occursprotected boolean isMultiTile()
protected void determineEncodedColorModel()
public void encode(java.io.OutputStream out) throws java.io.IOException
out
- the OutputStreamjava.io.IOException
- if an I/O error occurspublic void encodeAlpha(java.io.OutputStream out) throws java.io.IOException
IllegalStateException
is thrown.out
- the OutputStreamjava.io.IOException
- if an I/O error occurspublic static void encodePackedColorComponents(java.awt.image.RenderedImage image, java.io.OutputStream out) throws java.io.IOException
image
- the image to be encodedout
- the OutputStream to write tojava.io.IOException
- if an I/O error occurspublic static ImageEncoder createRenderedImageEncoder(java.awt.image.RenderedImage img)
img
- the imageCopyright 1999-2008 The Apache Software Foundation. All Rights Reserved.