Class ColorTintFilter

  extended by org.jdesktop.beans.AbstractBean
      extended by org.jdesktop.swingx.image.AbstractFilter
          extended by org.jdesktop.swingx.image.ColorTintFilter
All Implemented Interfaces:

public class ColorTintFilter
extends AbstractFilter

A color tint filter can be used to mix a solid color to an image. The result is an image tinted by the specified color. The force of the effect can be controlled with the mixValue, a number between 0.0 and 1.0 that can be seen as the percentage of the mix (0.0 does not affect the source image and 1.0 replaces all the pixels by the solid color).

The color of the pixels in the resulting image is computed as follows:

 cR = cS * (1 - mixValue) + cM * mixValue

Definition of the parameters:

Constructor Summary
ColorTintFilter(Color mixColor, float mixValue)
          Creates a new color mixer filter.
Method Summary
 BufferedImage filter(BufferedImage src, BufferedImage dst)
          Performs a single-input/single-output operation on a BufferedImage.
 Color getMixColor()
          Returns the solid mix color of this filter.
 float getMixValue()
          Returns the mix value of this filter.
Methods inherited from class org.jdesktop.swingx.image.AbstractFilter
createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ColorTintFilter(Color mixColor,
                       float mixValue)

Creates a new color mixer filter. The specified color will be used to tint the source image, with a mixing strength defined by mixValue.

mixColor - the solid color to mix with the source image
mixValue - the strength of the mix, between 0.0 and 1.0; if the specified value lies outside this range, it is clamped
IllegalArgumentException - if mixColor is null
Method Detail


public float getMixValue()

Returns the mix value of this filter.

the mix value, between 0.0 and 1.0


public Color getMixColor()

Returns the solid mix color of this filter.

the solid color used for mixing


public BufferedImage filter(BufferedImage src,
                            BufferedImage dst)
Performs a single-input/single-output operation on a BufferedImage. If the color models for the two images do not match, a color conversion into the destination color model is performed. If the destination image is null, a BufferedImage with an appropriate ColorModel is created.

An IllegalArgumentException may be thrown if the source and/or destination image is incompatible with the types of images $ allowed by the class implementing this filter.

Specified by:
filter in interface BufferedImageOp
Specified by:
filter in class AbstractFilter
src - The BufferedImage to be filtered
dst - The BufferedImage in which to store the results$
The filtered BufferedImage.