|
NextApp Echo App Container 1.0.5 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nextapp.echoservlet.image.PngEncoder
Encodes a java.awt.Image into PNG format. For more information on the PNG specification, see the W3C PNG page at http://www.w3.org/TR/REC-png.html.
Nested Class Summary | |
private static class |
PngEncoder.AverageFilter
An implementation of an "Average" filter. |
private class |
PngEncoder.ByteTranslator
Translates byte-based rasters. |
static interface |
PngEncoder.Filter
An interface for PNG filters. |
private class |
PngEncoder.IntTranslator
Translates integer-based rasters. |
private static class |
PngEncoder.PaethFilter
An implementation of a "Paeth" filter. |
private static class |
PngEncoder.SubFilter
An implementation of a "Sub" filter. |
(package private) static interface |
PngEncoder.Translator
An interface for translators, which translate pixel data from a writable raster into an R/G/B/A ordering required by the PNG specification. |
private static class |
PngEncoder.UpFilter
An implementation of an "Up" filter. |
Field Summary | |
static PngEncoder.Filter |
AVERAGE_FILTER
|
private static int |
AVERAGE_FILTER_TYPE
|
private static byte |
BIT_DEPTH
|
private static byte |
COLOR_TYPE_INDEXED
|
private static byte |
COLOR_TYPE_RGB
|
private static byte |
COLOR_TYPE_RGBA
|
private int |
compressionLevel
|
private boolean |
encodeAlpha
|
private PngEncoder.Filter |
filter
|
private int |
height
|
private static byte[] |
IDAT
|
private static byte[] |
IEND
|
private static byte[] |
IHDR
|
private java.awt.image.BufferedImage |
image
|
private int |
inputBpp
|
private static int[] |
INT_TRANSLATOR_CHANNEL_MAP
|
private int |
outputBpp
|
static PngEncoder.Filter |
PAETH_FILTER
|
private static int |
PAETH_FILTER_TYPE
|
private static byte[] |
PLTE
|
private java.awt.image.Raster |
raster
|
private static byte[] |
SIGNATURE
|
static PngEncoder.Filter |
SUB_FILTER
|
private static int |
SUB_FILTER_TYPE
|
private int |
transferType
|
private PngEncoder.Translator |
translator
|
static PngEncoder.Filter |
UP_FILTER
|
private static int |
UP_FILTER_TYPE
|
private int |
width
|
Constructor Summary | |
PngEncoder(java.awt.Image image,
boolean encodeAlpha,
PngEncoder.Filter filter,
int compressionLevel)
Creates a PNG encoder for an image. |
Method Summary | |
void |
encode(java.io.OutputStream out)
Encodes the image. |
private void |
writeIdatChunks(java.io.OutputStream out,
java.util.zip.Checksum csum)
Writes the IDAT (Image data) chunks to the output stream. |
private void |
writeIendChunk(java.io.OutputStream out,
java.util.zip.Checksum csum)
Writes the IEND (End-of-file) chunk to the output stream. |
private void |
writeIhdrChunk(java.io.OutputStream out,
java.util.zip.Checksum csum)
Writes the IHDR (Image Header) chunk to the output stream. |
private static void |
writeInt(java.io.OutputStream out,
int i)
Writes an 32-bit integer value to the output stream. |
private void |
writePlteChunk(java.io.OutputStream out,
java.util.zip.Checksum csum)
Writes the PLTE (Palette) chunk to the output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final PngEncoder.Filter SUB_FILTER
public static final PngEncoder.Filter UP_FILTER
public static final PngEncoder.Filter AVERAGE_FILTER
public static final PngEncoder.Filter PAETH_FILTER
private static final byte[] SIGNATURE
private static final byte[] IHDR
private static final byte[] PLTE
private static final byte[] IDAT
private static final byte[] IEND
private static final int SUB_FILTER_TYPE
private static final int UP_FILTER_TYPE
private static final int AVERAGE_FILTER_TYPE
private static final int PAETH_FILTER_TYPE
private static final byte BIT_DEPTH
private static final byte COLOR_TYPE_INDEXED
private static final byte COLOR_TYPE_RGB
private static final byte COLOR_TYPE_RGBA
private static final int[] INT_TRANSLATOR_CHANNEL_MAP
private java.awt.image.BufferedImage image
private boolean encodeAlpha
private PngEncoder.Filter filter
private int compressionLevel
private int width
private int height
private int transferType
private java.awt.image.Raster raster
private int inputBpp
private int outputBpp
private PngEncoder.Translator translator
Constructor Detail |
public PngEncoder(java.awt.Image image, boolean encodeAlpha, PngEncoder.Filter filter, int compressionLevel)
image
- The image to be encoded.encodeAlpha
- True if the image's alpha channel should be encoded.filter
- The filter to be applied to the image data, one of the
following values:
compressionLevel
- The deflater compression level that will be used
for compressing the image data. Valid values range from 0 to 9.
Higher values result in smaller files and therefore decrease
network traffic, but require more CPU time to encode. The normal
compromise value is 3.Method Detail |
private static void writeInt(java.io.OutputStream out, int i) throws java.io.IOException
out
- The OutputStream to write the integer value to.i
- The integer to write tot he output stream.
java.io.IOException
public void encode(java.io.OutputStream out) throws java.io.IOException
out
- An OutputStream to which the encoded image will be
written.
java.io.IOException
- if a problem is encountered writing the output.private void writeIdatChunks(java.io.OutputStream out, java.util.zip.Checksum csum) throws java.io.IOException
out
- The OutputStream to write the chunk to.csum
- The Checksum that is updated as data is written
to the passed-in OutputStream.
java.io.IOException
- if a problem is encountered writing the output.private void writeIendChunk(java.io.OutputStream out, java.util.zip.Checksum csum) throws java.io.IOException
out
- The OutputStream to write the chunk to.csum
- The Checksum that is updated as data is written
to the passed-in OutputStream.
java.io.IOException
- if a problem is encountered writing the output.private void writeIhdrChunk(java.io.OutputStream out, java.util.zip.Checksum csum) throws java.io.IOException
out
- The OutputStream to write the chunk to.csum
- The Checksum that is updated as data is written
to the passed-in OutputStream.
java.io.IOException
- if a problem is encountered writing the output.private void writePlteChunk(java.io.OutputStream out, java.util.zip.Checksum csum) throws java.io.IOException
out
- The OutputStream to write the chunk to.csum
- The Checksum that is updated as data is written
to the passed-in OutputStream.
java.io.IOException
- if a problem is encountered writing the output.
|
NextApp Echo App Container 1.0.5 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |