RGBImageFilter is an abstract class that helps you filter images based on each pixel's color and position. In most cases, the only method you need to implement in subclasses is filterRGB(), which returns a new pixel value based on the old pixel's color and position. RGBImageFilter cannot be used to implement filters that depend on the value of neighboring pixels, or other factors aside from color and position.
public abstract class java.awt.image.RGBImageFilter extends java.awt.image.ImageFilter { // Variables protected boolean canFilterIndexColorModel; protected ColorModel newmodel; protected ColorModel oldmodel; // Instance Methods public IndexColorModel filterIndexColorModel (IndexColorModel icm); public abstract int filterRGB (int x, int y, int rgb); public void filterRGBPixels (int x, int y, int width, int height, int[] pixels, int off, int scansize); public void setColorModel (ColorModel model); public void setPixels (int x, int y, int width, int height, ColorModel model, byte[] pixels, int offset, int scansize); public void setPixels (int x, int y, int width, int height, ColorModel model, int[] pixels, int offset, int scansize); public void substituteColorModel (ColorModel oldModel, ColorModel newModel); }
Setting the canFilterIndexColorModel variable to true indicates the filter can filter IndexColorModel images. To filter an IndexColorModel, the filter must depend only on color, not on position.
A place to store a new ColorModel.
A place to store an old ColorModel.
Color model to filter.
Filtered color model.
Helper method for setColorModel() that runs the entire color table of icm through the filterRGB() method of the subclass. Used only if canFilterIndexColorModel is true, and the image uses an IndexColorModel.
x-coordinate of pixel data.
y-coordinate of pixel data.
Color value of pixel to filter.
New color value of pixel.
Subclasses implement this method to provide a filtering function that generates new pixels.
x-coordinate of top-left corner of pixel data within entire image.
y-coordinate of top-left corner of pixel data within entire image.
Width of pixel data within entire image.
Height of pixel data within entire image.
Image data.
Offset from beginning of each line in pixels array.
Size of each line of data in pixels array.
Helper method for setPixels() that filters each element of the pixels buffer through the subclass's filterRGB() method.
The color model for the image.
ImageFilter.setColorModel(ColorModel)
Sets the image's color model.
x-coordinate of top-left corner of pixel data delivered with this method call.
y-coordinate of top-left corner of pixel data delivered with this method call.
Width of the rectangle of pixel data delivered with this method call.
Height of the rectangle of pixel data delivered with this method call.
Color model of image data.
Image data.
Offset from beginning of the pixels array.
Size of each line of data in pixels array.
ImageFilter.setPixels(int, int, int, int, ColorModel, byte[], int, int)
Called by the ImageProducer to deliver a rectangular block of pixels for filtering.
x-coordinate of top-left corner of pixel data delivered with this method call.
y-coordinate of top-left corner of pixel data delivered with this method call.
Width of the rectangle of pixel data delivered with this method call.
Height of the rectangle of pixel data delivered with this method call.
Color model of image data.
Image data.
Offset from beginning of the pixels array.
Size of each line of data in pixels array.
ImageFilter.setPixels(int, int, int, int, ColorModel, int[], int, int)
Called by the ImageProducer to deliver a rectangular block of pixels for filtering.
New value for origmodel variable.
New value for newmodel variable.
Helper method for setColorModel() to initialize the protected variables newmodel and origmodel.
ColorModel, ImageFilter