|
xmlgraphics-commons 2.0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xmlgraphics.ps.ImageEncodingHelper
public class ImageEncodingHelper
Helper class for encoding bitmap images.
Constructor Summary | |
---|---|
ImageEncodingHelper(RenderedImage image)
Main constructor |
|
ImageEncodingHelper(RenderedImage image,
boolean enableCMYK)
Main constructor |
Method Summary | |
---|---|
static ImageEncoder |
createRenderedImageEncoder(RenderedImage img)
Create an ImageEncoder for the given RenderImage instance. |
protected void |
determineEncodedColorModel()
Determines the color model used for encoding the image. |
void |
encode(OutputStream out)
Encodes the image and writes everything to the given OutputStream. |
void |
encodeAlpha(OutputStream out)
Encodes the image's alpha channel. |
static void |
encodePackedColorComponents(RenderedImage image,
OutputStream out)
Writes all pixels (color components only) of a RenderedImage to an OutputStream. |
static void |
encodeRenderedImageAsRGB(RenderedImage image,
OutputStream out)
|
static void |
encodeRenderedImageAsRGB(RenderedImage image,
OutputStream out,
boolean outputbw,
boolean bwinvert)
Writes a RenderedImage to an OutputStream by converting it to RGB. |
static boolean |
encodeRenderedImageWithDirectColorModelAsRGB(RenderedImage image,
OutputStream out)
Writes a RenderedImage to an OutputStream. |
static void |
encodeRGBAsGrayScale(byte[] raw,
int width,
int height,
int bitsPerPixel,
OutputStream out)
Converts a byte array containing 24 bit RGB image data to a grayscale image. |
ColorModel |
getEncodedColorModel()
Returns the effective ColorModel used to encode the image. |
RenderedImage |
getImage()
Returns the associated 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. |
void |
setBWInvert(boolean v)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageEncodingHelper(RenderedImage image)
image
- the imagepublic ImageEncodingHelper(RenderedImage image, boolean enableCMYK)
image
- the imageenableCMYK
- true to enable CMYK, false to disableMethod Detail |
---|
public RenderedImage getImage()
public ColorModel getNativeColorModel()
ColorModel
used by the image.
public 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(RenderedImage image, OutputStream out) throws IOException
IOException
public static void encodeRenderedImageAsRGB(RenderedImage image, OutputStream out, boolean outputbw, boolean bwinvert) throws IOException
image
- the imageout
- the OutputStream to write the pixels to
IOException
- if an I/O error occurspublic static boolean encodeRenderedImageWithDirectColorModelAsRGB(RenderedImage image, OutputStream out) throws IOException
DirectColorModel
as it is returned by ColorModel.getRGBdefault()
.
image
- the imageout
- the OutputStream to write the pixels to
IOException
- if an I/O error occurspublic static void encodeRGBAsGrayScale(byte[] raw, int width, int height, int bitsPerPixel, OutputStream out) throws IOException
raw
- the buffer containing the RGB image datawidth
- the width of the image in pixelsheight
- the height of the image in pixelsbitsPerPixel
- the number of bits to use per pixelout
- the OutputStream to write the pixels to
IOException
- if an I/O error occursprotected boolean isMultiTile()
protected void determineEncodedColorModel()
public void encode(OutputStream out) throws IOException
out
- the OutputStream
IOException
- if an I/O error occurspublic void encodeAlpha(OutputStream out) throws IOException
IllegalStateException
is thrown.
out
- the OutputStream
IOException
- if an I/O error occurspublic static void encodePackedColorComponents(RenderedImage image, OutputStream out) throws IOException
image
- the image to be encodedout
- the OutputStream to write to
IOException
- if an I/O error occurspublic static ImageEncoder createRenderedImageEncoder(RenderedImage img)
img
- the image
public void setBWInvert(boolean v)
|
xmlgraphics-commons 2.0.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |