com.genuts.gameui.image
Class TransparentColorFilter
java.lang.Object
|
+--java.awt.image.ImageFilter
|
+--java.awt.image.RGBImageFilter
|
+--com.genuts.gameui.image.TransparentColorFilter
- All Implemented Interfaces:
- java.lang.Cloneable, java.awt.image.ImageConsumer
- public class TransparentColorFilter
- extends java.awt.image.RGBImageFilter
Converts a given color of an image to the transparent pixel.
Here is the code for simplest way of use for this filter:
Image transpImage = playfield.createImage(new FilteredImageSource(image.getSource(),
new TransparentColorFilter(transpRGB)));
- See Also:
java.awt.image.RGBImageFilter
,
java.awt.image.FilteredImageSource
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 |
Method Summary |
int |
filterRGB(int x,
int y,
int rgb)
Converts a single input pixel in the default RGB ColorModel to a single output 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 |
TransparentColorFilter
public TransparentColorFilter(int transpRGB)
- Creates the filter with the given color to convert.
- Parameters:
transpRGB
- transparent color to convert.
filterRGB
public int filterRGB(int x,
int y,
int rgb)
- Converts a single input pixel in the default RGB ColorModel to a single output pixel.
If the input color pixel is the transpRGB, this pixel will be converted to
a transparent pixel.
- Specified by:
filterRGB
in class java.awt.image.RGBImageFilter
Genuts API