<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.awt.image.RGBImageFilter
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.image.html">This Package</a>  <a href="java.awt.image.PixelGrabber.html#_top_">Previous</a>  <a href="java.awt.image.ReplicateScaleFilter.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.awt.image.RGBImageFilter
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.awt.image.ImageFilter.html#_top_">java.awt.image.ImageFilter</a>
           |
           +----java.awt.image.RGBImageFilter
</pre>
<hr>
<dl>
  <dt> public abstract class <b>RGBImageFilter</b>
  <dt> extends <a href="java.awt.image.ImageFilter.html#_top_">ImageFilter</a>
</dl>
This class provides an easy way to create an ImageFilter which modifies
 the pixels of an image in the default RGB ColorModel.  It is meant to
 be used in conjunction with a FilteredImageSource object to produce
 filtered versions of existing images.  It is an abstract class that
 provides the calls needed to channel all of the pixel data through a
 single method which converts pixels one at a time in the default RGB
 ColorModel regardless of the ColorModel being used by the ImageProducer.
 The only method which needs to be defined to create a useable image
 filter is the filterRGB method.  Here is an example of a definition
 of a filter which swaps the red and blue components of an image:
 <pre>
	class RedBlueSwapFilter extends RGBImageFilter {
	    public RedBlueSwapFilter() {
		// The filter's operation does not depend on the
		// pixel's location, so IndexColorModels can be
		// filtered directly.
		canFilterIndexColorModel = true;
	    }
	    public int filterRGB(int x, int y, int rgb) {
		return ((rgb & 0xff00ff00)
			| ((rgb & 0xff0000) >> 16)
			| ((rgb & 0xff) << 16));
	    }
	}
 </pre>
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.FilteredImageSource.html#_top_">FilteredImageSource</a>, <a href="java.awt.image.ImageFilter.html#_top_">ImageFilter</a>, <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#canFilterIndexColorModel"><b>canFilterIndexColorModel</b></a>
  <dd>  This boolean indicates whether or not it is acceptable to apply
 the color filtering of the filterRGB method to the color table
 entries of an IndexColorModel object in lieu of pixel by pixel
 filtering.
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#newmodel"><b>newmodel</b></a>
  <dd> 
  <dt> <img src="images/magenta-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#origmodel"><b>origmodel</b></a>
  <dd> 
</dl>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#RGBImageFilter()"><b>RGBImageFilter</b></a>()
  <dd> 
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#filterIndexColorModel(java.awt.image.IndexColorModel)"><b>filterIndexColorModel</b></a>(IndexColorModel)
  <dd>  Filters an IndexColorModel object by running each entry in its
 color tables through the filterRGB function that RGBImageFilter
 subclasses must provide.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#filterRGB(int, int, int)"><b>filterRGB</b></a>(int, int, int)
  <dd>  Subclasses must specify a method to convert a single input pixel
 in the default RGB ColorModel to a single output pixel.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#filterRGBPixels(int, int, int, int, int[], int, int)"><b>filterRGBPixels</b></a>(int, int, int, int, int[], int, int)
  <dd>  Filters a buffer of pixels in the default RGB ColorModel by passing
 them one by one through the filterRGB method.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setColorModel(java.awt.image.ColorModel)"><b>setColorModel</b></a>(ColorModel)
  <dd>  If the ColorModel is an IndexColorModel, and the subclass has
 set the canFilterIndexColorModel flag to true, we substitute
 a filtered version of the color model here and wherever
 that original ColorModel object appears in the setPixels methods.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int)"><b>setPixels</b></a>(int, int, int, int, ColorModel, byte[], int, int)
  <dd>  If the ColorModel object is the same one that has already
 been converted, then simply passes the pixels through with the
 converted ColorModel.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)"><b>setPixels</b></a>(int, int, int, int, ColorModel, int[], int, int)
  <dd>  If the ColorModel object is the same one that has already
 been converted, then simply passes the pixels through with the
 converted ColorModel, otherwise converts the buffer of integer
 pixels to the default RGB ColorModel and passes the converted
 buffer to the filterRGBPixels method to be converted one by one.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#substituteColorModel(java.awt.image.ColorModel, java.awt.image.ColorModel)"><b>substituteColorModel</b></a>(ColorModel, ColorModel)
  <dd>  Registers two ColorModel objects for substitution.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="origmodel"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>origmodel</b>
<pre>
 protected <a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> origmodel
</pre>
<a name="newmodel"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>newmodel</b>
<pre>
 protected <a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> newmodel
</pre>
<a name="canFilterIndexColorModel"><img src="images/magenta-ball.gif" width=12 height=12 alt=" o "></a>
<b>canFilterIndexColorModel</b>
<pre>
 protected boolean canFilterIndexColorModel
</pre>
<dl>
  <dd> This boolean indicates whether or not it is acceptable to apply
 the color filtering of the filterRGB method to the color table
 entries of an IndexColorModel object in lieu of pixel by pixel
 filtering.  Subclasses should set this variable to true in their
 constructor if their filterRGB method does not depend on the
 coordinate of the pixel being filtered.<p>
  <dd><dl> 
    <dt> <b>See Also:</b>
    <dd> <a href="#substituteColorModel">substituteColorModel</a>, <a href="#filterRGB">filterRGB</a>, <a href="java.awt.image.IndexColorModel.html#_top_">IndexColorModel</a>
  </dl></dd>
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="RGBImageFilter"></a>
<a name="RGBImageFilter()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>RGBImageFilter</b>
<pre>
 public RGBImageFilter()
</pre>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="setColorModel(java.awt.image.ColorModel)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setColorModel"><b>setColorModel</b></a>
<pre>
 public void setColorModel(<a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> model)
</pre>
<dl>
  <dd> If the ColorModel is an IndexColorModel, and the subclass has
 set the canFilterIndexColorModel flag to true, we substitute
 a filtered version of the color model here and wherever
 that original ColorModel object appears in the setPixels methods. Otherwise
 overrides the default ColorModel used by the ImageProducer and
 specifies the default RGB ColorModel instead.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.image.ImageFilter.html#setColorModel(java.awt.image.ColorModel)">setColorModel</a> in class <a href="java.awt.image.ImageFilter.html#_top_">ImageFilter</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.ImageConsumer.html#_top_">ImageConsumer</a>, <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>
  </dl></dd>
</dl>
<a name="substituteColorModel(java.awt.image.ColorModel, java.awt.image.ColorModel)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="substituteColorModel"><b>substituteColorModel</b></a>
<pre>
 public void substituteColorModel(<a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> oldcm,
                                  <a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> newcm)
</pre>
<dl>
  <dd> Registers two ColorModel objects for substitution.  If the oldcm
 is encountered during any of the setPixels methods, the newcm
 is substituted and the pixels passed through
 untouched (but with the new ColorModel object).
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> oldcm - the ColorModel object to be replaced on the fly
    <dd> newcm - the ColorModel object to replace oldcm on the fly
  </dl></dd>
</dl>
<a name="filterIndexColorModel(java.awt.image.IndexColorModel)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="filterIndexColorModel"><b>filterIndexColorModel</b></a>
<pre>
 public <a href="java.awt.image.IndexColorModel.html#_top_">IndexColorModel</a> filterIndexColorModel(<a href="java.awt.image.IndexColorModel.html#_top_">IndexColorModel</a> icm)
</pre>
<dl>
  <dd> Filters an IndexColorModel object by running each entry in its
 color tables through the filterRGB function that RGBImageFilter
 subclasses must provide.  Uses coordinates of -1 to indicate that
 a color table entry is being filtered rather than an actual
 pixel value.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> icm - the IndexColorModel object to be filtered
    <dt> <b>Returns:</b>
    <dd> a new IndexColorModel representing the filtered colors
  </dl></dd>
</dl>
<a name="filterRGBPixels(int, int, int, int, int[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="filterRGBPixels"><b>filterRGBPixels</b></a>
<pre>
 public void filterRGBPixels(int x,
                             int y,
                             int w,
                             int h,
                             int pixels[],
                             int off,
                             int scansize)
</pre>
<dl>
  <dd> Filters a buffer of pixels in the default RGB ColorModel by passing
 them one by one through the filterRGB method.
<p>
  <dd><dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>, <a href="#filterRGB">filterRGB</a>
  </dl></dd>
</dl>
<a name="setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setPixels"><b>setPixels</b></a>
<pre>
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       <a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> model,
                       byte pixels[],
                       int off,
                       int scansize)
</pre>
<dl>
  <dd> If the ColorModel object is the same one that has already
 been converted, then simply passes the pixels through with the
 converted ColorModel. Otherwise converts the buffer of byte
 pixels to the default RGB ColorModel and passes the converted
 buffer to the filterRGBPixels method to be converted one by one.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.image.ImageFilter.html#setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int)">setPixels</a> in class <a href="java.awt.image.ImageFilter.html#_top_">ImageFilter</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>, <a href="#filterRGBPixels">filterRGBPixels</a>
  </dl></dd>
</dl>
<a name="setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setPixels"><b>setPixels</b></a>
<pre>
 public void setPixels(int x,
                       int y,
                       int w,
                       int h,
                       <a href="java.awt.image.ColorModel.html#_top_">ColorModel</a> model,
                       int pixels[],
                       int off,
                       int scansize)
</pre>
<dl>
  <dd> If the ColorModel object is the same one that has already
 been converted, then simply passes the pixels through with the
 converted ColorModel, otherwise converts the buffer of integer
 pixels to the default RGB ColorModel and passes the converted
 buffer to the filterRGBPixels method to be converted one by one.
 Converts a buffer of integer pixels to the default RGB ColorModel
 and passes the converted buffer to the filterRGBPixels method.
<p>
  <dd><dl>
    <dt> <b>Overrides:</b>
    <dd> <a href="java.awt.image.ImageFilter.html#setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)">setPixels</a> in class <a href="java.awt.image.ImageFilter.html#_top_">ImageFilter</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>, <a href="#filterRGBPixels">filterRGBPixels</a>
  </dl></dd>
</dl>
<a name="filterRGB(int, int, int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="filterRGB"><b>filterRGB</b></a>
<pre>
 public abstract int filterRGB(int x,
                               int y,
                               int rgb)
</pre>
<dl>
  <dd> Subclasses must specify a method to convert a single input pixel
 in the default RGB ColorModel to a single output pixel.
<p>
  <dd><dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.awt.image.ColorModel.html#getRGBdefault">getRGBdefault</a>, <a href="#filterRGBPixels">filterRGBPixels</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.awt.image.html">This Package</a>  <a href="java.awt.image.PixelGrabber.html#_top_">Previous</a>  <a href="java.awt.image.ReplicateScaleFilter.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
