RGBImageFilter

Name

RGBImageFilter

[Graphic: Figure from the text]

Description

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.

Class Definition

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);
}

Variables

canFilterIndexColorModel

protected boolean canFilterIndexColorModel

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.

newmodel

protected ColorModel newmodel

A place to store a new ColorModel.

origmodel

protected ColorModel origmodel

A place to store an old ColorModel.

Instance Methods

filterIndexColorModel

public IndexColorModel filterIndexColorModel (IndexColorModel icm)

filterRGB

public abstract int filterRGB (int x, int y, int rgb)

filterRGBPixels

public void filterRGBPixels (int x, int y, int width, int height, int[] pixels, int off, int scansize)

setColorModel

public void setColorModel (ColorModel model)

setPixels

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)

substituteColorModel

public void substituteColorModel (ColorModel oldModel, ColorModel newModel)

See Also

ColorModel, ImageFilter