org.zkoss.image.encoder
Class JPEGEncoder

java.lang.Object
  extended by org.zkoss.image.encoder.JPEGEncoder
All Implemented Interfaces:
ImageEncoder

public class JPEGEncoder
extends java.lang.Object
implements ImageEncoder

The encoder for encoding an image into the JPEG format

Since:
3.0.7
Author:
tomyeh

Constructor Summary
JPEGEncoder()
           
 
Method Summary
 byte[] encode(java.awt.image.RenderedImage image)
          Encodes an AWT image into a byte array in a particular format.
 float getQuality()
          Returns the quality of the image encoding.
 boolean isEncodingAlpha()
          Returns whether to encode the alpha transparency.
 void setEncodingAlpha(boolean encodeAlpha)
          Sets whether to encode the alpha transparency.
 void setQuality(float quality)
          Sets the quality of the image encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPEGEncoder

public JPEGEncoder()
Method Detail

encode

public byte[] encode(java.awt.image.RenderedImage image)
              throws java.io.IOException
Description copied from interface: ImageEncoder
Encodes an AWT image into a byte array in a particular format.

Specified by:
encode in interface ImageEncoder
Throws:
java.io.IOException

getQuality

public float getQuality()
Returns the quality of the image encoding. It is a number between 0 and 1. The higher the value, the better the output quality.

Default: 0.95f.

Specified by:
getQuality in interface ImageEncoder

setQuality

public void setQuality(float quality)
Description copied from interface: ImageEncoder
Sets the quality of the image encoding. Simply does nothing if the encoder does not support it.

Specified by:
setQuality in interface ImageEncoder

isEncodingAlpha

public boolean isEncodingAlpha()
Description copied from interface: ImageEncoder
Returns whether to encode the alpha transparency.

Specified by:
isEncodingAlpha in interface ImageEncoder

setEncodingAlpha

public void setEncodingAlpha(boolean encodeAlpha)
Description copied from interface: ImageEncoder
Sets whether to encode the alpha transparency. Simply does nothing if the encoder does not support it.

Specified by:
setEncodingAlpha in interface ImageEncoder


Copyright © 2005-2011 Potix Corporation. All Rights Reserved. SourceForge.net Logo