org.zkoss.image
Class Images

java.lang.Object
  extended by org.zkoss.image.Images

public class Images
extends java.lang.Object

Utilities to handle images.

Since:
3.0.7
Author:
tomyeh

Constructor Summary
Images()
           
 
Method Summary
static Image encode(java.lang.String name, java.awt.image.RenderedImage image)
          Encodes an AWT image into a ZK image.
static Image encode(java.lang.String name, java.awt.image.RenderedImage image, float quality, boolean encodeAlpha)
          Encodes an AWT image into a ZK image (in PNG, JPEG or other format).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Images

public Images()
Method Detail

encode

public static Image encode(java.lang.String name,
                           java.awt.image.RenderedImage image,
                           float quality,
                           boolean encodeAlpha)
                    throws java.io.IOException
Encodes an AWT image into a ZK image (in PNG, JPEG or other format).

Parameters:
name - The name of the image. The extension of the name must be the format. Supported format: png and jpeg. For example, foo.png and foo.jpeg.
image - The AWT image to be encoded.
quality - The quality to use for the image encoding. It is a number between 0 and 1. The higher the value, the better the output quality. Not applicable to "png".
encodeAlpha - Whether to encode alpha transparency. Not applicable to "png".
Throws:
java.lang.IllegalArgumentException - if name doesn't contain an extension with supported format.
java.io.IOException

encode

public static Image encode(java.lang.String name,
                           java.awt.image.RenderedImage image)
                    throws java.io.IOException
Encodes an AWT image into a ZK image.

Parameters:
name - The name of the image. The extension of the name must be the format. For example, foo.png and foo.jpeg.
image - The AWT image to be encoded.
Throws:
java.lang.IllegalArgumentException - if name doesn't contain an extension with supported format.
java.io.IOException


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