Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## echopointng.image
Class PngEncoder

    java.lang.Object
      echopointng.image.PngEncoder

All Implemented Interfaces:
  ImageEncoder, java.io.Serializable

    public class PngEncoder

extends java.lang.Object
implements ImageEncoder, java.io.Serializable

`PngEncoder` implements the `ImageEncoder` interface and hence can take a java.awt.Image object and encode it as a PNG output stream.

The Image can have a `DirectColorModel` or an `IndexColorModel`.

NOTE : While the Echo framework has a PNG encoder built in to it, it currently does not handle transparency correctly. Therefore this encoder has been provided.

See Also:
  Serialized Form

Constructor Summary
`PngEncoder()` Constructs a PngEncoder ready to start encoding, with the Alpha channel being encoded.

Method Summary
`void` | `encode(java.awt.Image image, java.io.OutputStream out)`
`java.lang.String` | `getContentType()`
`boolean` | `isEncodeAlpha()` This returns true if the Alpha channel of the image will be encoded
`void` | `setEncodeAlpha(boolean b)` If this is set to true then the Alpha channel of the image will be encoded.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PngEncoder

    public PngEncoder()

  Constructs a PngEncoder ready to start encoding, with the Alpha channel being encoded.

Method Detail

### encode

    public void encode(java.awt.Image image,
                       java.io.OutputStream out)
                throws java.io.IOException

  Specified by:
    `encode` in interface `ImageEncoder`
  Throws:
    `java.io.IOException`
  See Also:
    `ImageEncoder.encode(java.awt.Image, java.io.OutputStream)`

### getContentType

    public java.lang.String getContentType()

  Specified by:
    `getContentType` in interface `ImageEncoder`
  See Also:
    `ImageEncoder.getContentType()`

### isEncodeAlpha

    public boolean isEncodeAlpha()

  This returns true if the Alpha channel of the image will be encoded

  Returns:
    - true if the Alpha channel of the image will be encoded

### setEncodeAlpha

    public void setEncodeAlpha(boolean b)

  If this is set to true then the Alpha channel of the image will be encoded. By this value is true by default.

  Parameters:
    `b` - - true if the Alpha channel of the image is to be encoded

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD