Package com.jidesoft.icons
Class MaskFilter
- java.lang.Object
-
- java.awt.image.ImageFilter
-
- java.awt.image.RGBImageFilter
-
- com.jidesoft.icons.MaskFilter
-
- All Implemented Interfaces:
java.awt.image.ImageConsumer
,java.lang.Cloneable
public class MaskFilter extends java.awt.image.RGBImageFilter
An image filter that replaces one color in an image with another color.
-
-
Constructor Summary
Constructors Constructor Description MaskFilter(java.awt.Color oldColor, java.awt.Color newColor)
Constructs a MaskFilter object that filters color of image to another color Please note, you can also usegetInstance(java.awt.Color, java.awt.Color)
to reuse the same instance of MaskFilter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.awt.Image
createImage(java.awt.Image i, java.awt.Color oldColor, java.awt.Color newColor)
Creates an image from an existing one by replacing the old color with the new color.static java.awt.Image
createNegativeImage(java.awt.Image i)
Creates an image as negative of an existing one.int
filterRGB(int x, int y, int rgb)
OverridesRGBImageFilter.filterRGB
.static MaskFilter
getInstance(java.awt.Color oldColor, java.awt.Color newColor)
-
Methods inherited from class java.awt.image.RGBImageFilter
filterIndexColorModel, filterRGBPixels, setColorModel, setPixels, setPixels, substituteColorModel
-
-
-
-
Constructor Detail
-
MaskFilter
public MaskFilter(java.awt.Color oldColor, java.awt.Color newColor)
Constructs a MaskFilter object that filters color of image to another color Please note, you can also usegetInstance(java.awt.Color, java.awt.Color)
to reuse the same instance of MaskFilter.- Parameters:
oldColor
- old color in exist image that needs to be replaced by new colornewColor
- new color to replace the old color
-
-
Method Detail
-
getInstance
public static MaskFilter getInstance(java.awt.Color oldColor, java.awt.Color newColor)
-
createImage
public static java.awt.Image createImage(java.awt.Image i, java.awt.Color oldColor, java.awt.Color newColor)
Creates an image from an existing one by replacing the old color with the new color.
-
createNegativeImage
public static java.awt.Image createNegativeImage(java.awt.Image i)
Creates an image as negative of an existing one. It will basically replace the black color with white color.
-
filterRGB
public int filterRGB(int x, int y, int rgb)
OverridesRGBImageFilter.filterRGB
.- Specified by:
filterRGB
in classjava.awt.image.RGBImageFilter
-
-