com.tensegrity.gui.swing.icon
Class ColorFilter

java.lang.Object
  extended byjava.awt.image.ImageFilter
      extended byjava.awt.image.RGBImageFilter
          extended bycom.tensegrity.gui.swing.icon.ColorFilter
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageConsumer

public class ColorFilter
extends java.awt.image.RGBImageFilter

The ColorFilter class can be used to filter image instances. Images hue value will be changed to be a variation of a base color, specified by a given ColorScale instance. Use the createColorFilteredImage(Image, ColorScale)-method to filter an image.

Version:
$Id: ColorFilter.java,v 1.3 2005/07/14 11:11:22 MichaelKegel Exp $
Author:
GillesIachelini

Field Summary
 
Fields inherited from class java.awt.image.RGBImageFilter
canFilterIndexColorModel, newmodel, origmodel
 
Fields inherited from class java.awt.image.ImageFilter
consumer
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
ColorFilter(com.tensegrity.gui.swing.icon.ColorScale scale)
          Creates a new ColorFilter based on the given ColorScale.
 
Method Summary
static java.awt.Image createColorFilteredImage(java.awt.Image i, com.tensegrity.gui.swing.icon.ColorScale scale)
          Creates a new filtered image from the given parameter Image by using the given scale instance.
 int filterRGB(int x, int y, int rgb)
          This method filters the given pixel.
 
Methods inherited from class java.awt.image.RGBImageFilter
filterIndexColorModel, filterRGBPixels, setColorModel, setPixels, setPixels, substituteColorModel
 
Methods inherited from class java.awt.image.ImageFilter
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorFilter

public ColorFilter(com.tensegrity.gui.swing.icon.ColorScale scale)
Creates a new ColorFilter based on the given ColorScale.

Parameters:
scale - the ColorScale instance to be used while processing pixels.
Method Detail

createColorFilteredImage

public static java.awt.Image createColorFilteredImage(java.awt.Image i,
                                                      com.tensegrity.gui.swing.icon.ColorScale scale)
Creates a new filtered image from the given parameter Image by using the given scale instance.

Parameters:
i - The image instance to filter.
scale - the ColorScale instance to use.
Returns:
a new filtered image.

filterRGB

public int filterRGB(int x,
                     int y,
                     int rgb)
This method filters the given pixel. The x,y are ignored. Each pixels hue value will be set to the stored value from the internal ColorScale instance. If the modification of the hue value had an impact on the rgb value, the luminance is additionally reduced about 15%. Thus black stays black, white white and gray gray.

See Also:
RGBImageFilter.filterRGB(int, int, int)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.