NextApp Echo3
v3.0.b4

nextapp.echo.webcontainer.util
Class PngEncoder

java.lang.Object
  extended by nextapp.echo.webcontainer.util.PngEncoder

public class PngEncoder
extends java.lang.Object

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
static interface PngEncoder.Filter
          An interface for PNG filters.
 
Field Summary
static PngEncoder.Filter AVERAGE_FILTER
          AverageFilter singleton.
static PngEncoder.Filter PAETH_FILTER
          PaethFilter singleton.
static PngEncoder.Filter SUB_FILTER
          SubFilter singleton.
static PngEncoder.Filter UP_FILTER
          UpFilter singleton.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUB_FILTER

public static final PngEncoder.Filter SUB_FILTER
SubFilter singleton.


UP_FILTER

public static final PngEncoder.Filter UP_FILTER
UpFilter singleton.


AVERAGE_FILTER

public static final PngEncoder.Filter AVERAGE_FILTER
AverageFilter singleton.


PAETH_FILTER

public static final PngEncoder.Filter PAETH_FILTER
PaethFilter singleton.

Constructor Detail

PngEncoder

public PngEncoder(java.awt.Image image,
                  boolean encodeAlpha,
                  PngEncoder.Filter filter,
                  int compressionLevel)
Creates a PNG encoder for an image.

Parameters:
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:
  • SUB_FILTER
  • UP_FILTER
  • AVERAGE_FILTER
  • PAETH_FILTER
If a null value is specified, no filtering will be performed.
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

encode

public void encode(java.io.OutputStream out)
            throws java.io.IOException
Encodes the image.

Parameters:
out - an OutputStream to which the encoded image will be written
Throws:
java.io.IOException - if a problem is encountered writing the output

NextApp Echo3
v3.0.b4