deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.ogcwebservices.wpvs.utils
Class ImageUtils

java.lang.Object
  extended by org.deegree.ogcwebservices.wpvs.utils.ImageUtils

public class ImageUtils
extends java.lang.Object

Little utility class responsible for filtering an image and making it transparent based on an array of colors considered to be transparent. Users of this class initalize an object with a non-null Color array that represents colors, which are supposed to be completely transparent. By calling #filter( Image ), the colors found in image are substituted by transparent pixels.

Author:
Ugo Taddei, last edited by: $Author: mschneider $ $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $

Nested Class Summary
 class ImageUtils.ColorsToTransparentFilter
          An RGBImageFilter to substitute all input colors by a completely transparent one.
(package private)  class ImageUtils.TransparentImageFilter
          The TransparentImageFilter class filters an RGB-Pixel with a transparency.
 
Constructor Summary
ImageUtils()
          Creates a Imagefilter which makes an image transparent.
ImageUtils(java.awt.Color[] transparentColors)
          Creates a new ImageUtil object.
 
Method Summary
 java.awt.image.BufferedImage ensureRGBAImage(java.awt.image.BufferedImage image)
          Checks if the type of img is BufferedImage.TYPE_INT_ARGB and if is not, create a new one, just like img but with transparency
 java.awt.Image filterImage(java.awt.image.BufferedImage image)
          Filters an image and return a new partially transparent image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageUtils

public ImageUtils(java.awt.Color[] transparentColors)
Creates a new ImageUtil object.

Parameters:
transparentColors - the colors that will be substituted by a completely transparent color ('0x00FFFFFF'). transparentColors cannot be null.

ImageUtils

public ImageUtils()
Creates a Imagefilter which makes an image transparent.

Method Detail

filterImage

public java.awt.Image filterImage(java.awt.image.BufferedImage image)
Filters an image and return a new partially transparent image.

Parameters:
image - the image that is to be filtered.
Returns:
a new image whose colors are substituted accordign to the input traparent colors. The input image cannot be null.

ensureRGBAImage

public java.awt.image.BufferedImage ensureRGBAImage(java.awt.image.BufferedImage image)
Checks if the type of img is BufferedImage.TYPE_INT_ARGB and if is not, create a new one, just like img but with transparency

Parameters:
image - the image to be checked. Cannot be null.
Returns:
the same image, if its type is BufferedImage.TYPE_INT_ARGB, or a new transparent one.

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org