public abstract class RGBImageFilter extends ImageFilter
   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)); } }   
      | Modifier and Type | Field and Description | 
|---|---|
| protected boolean | canFilterIndexColorModel
              该布尔值指示是否可以将filterRGB方法的颜色过滤应用于IndexColorModel对象的颜色表条目,以代替逐像素过滤。 
             | 
| protected ColorModel | newmodel
              该 
              ColorModel用来替换origmodel当用户调用substituteColorModel。 | 
| protected ColorModel | origmodel | 
consumerCOMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT| Constructor and Description | 
|---|
| RGBImageFilter() | 
| Modifier and Type | Method and Description | 
|---|---|
| IndexColorModel | filterIndexColorModel(IndexColorModel icm)
              通过RGBImageFilter子类必须提供的filterRGB函数运行其颜色表中的每个条目来过滤IndexColorModel对象。 
             | 
| abstract int | filterRGB(int x, int y, int rgb)
              子类必须指定一种将默认RGB ColorModel中的单个输入像素转换为单个输出像素的方法。 
             | 
| void | filterRGBPixels(int x, int y, int w, int h, int[] pixels, int off, int scansize)
              通过filterRGB方法逐个传递默认RGB ColorModel中的像素缓冲区。 
             | 
| void | setColorModel(ColorModel model)
              如果ColorModel是IndexColorModel,并且子类将canFilterIndexColorModel标志设置为true,那么在这里替换颜色模型的过滤版本,并将原始ColorModel对象出现在setPixels方法中。 
             | 
| void | setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int off, int scansize)
              如果ColorModel对象与已经被转换的对象相同,那么只需将像素通过转换的ColorModel传递。 
             | 
| void | setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int off, int scansize)
              如果ColorModel对象与已经被转换的对象相同,那么只需将像素通过转换的ColorModel传递,否则将整数像素的缓冲区转换为默认的RGB ColorModel,并将转换后的缓冲区传递给filterRGBPixels方法进行转换一个 
             | 
| void | substituteColorModel(ColorModel oldcm, ColorModel newcm)
              注册两个ColorModel对象进行替换。 
             | 
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setPropertiesprotected ColorModel origmodel
protected ColorModel newmodel
ColorModel用来替换 
           origmodel当用户调用 
           substituteColorModel 。 
          protected boolean canFilterIndexColorModel
public void setColorModel(ColorModel model)
 注意:此方法的目的是由被过滤像素的ImageProducer的Image调用。 使用此类过滤图像中的像素的开发人员应避免直接调用此方法,因为该操作可能会干扰过滤操作。 
setColorModel在接口 
            ImageConsumer 
           setColorModel在 
            ImageFilter 
           model - 指定的 
            ColorModel 
           ImageConsumer , ColorModel.getRGBdefault() 
           public void substituteColorModel(ColorModel oldcm, ColorModel newcm)
oldcm - 即将更换的ColorModel对象 
           newcm - ColorModel对象即时替换oldcm 
           public IndexColorModel filterIndexColorModel(IndexColorModel icm)
icm - 要过滤的IndexColorModel对象 
           NullPointerException - 如果 
            icm为空 
           public void filterRGBPixels(int x,
                            int y,
                            int w,
                            int h,
                            int[] pixels,
                            int off,
                            int scansize) 
          x - 像素区域左上角的X坐标 
           y - 像素区域左上角的Y坐标 
           w - 像素区域的宽度 
           h - 像素区域的高度 
           pixels - 像素数组 
           off - 偏移到 
            pixels数组 
           scansize - 从阵列中的一行像素到下一个像素的距离 
           ColorModel.getRGBdefault() , 
            filterRGB(int, int, int) 
           public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      ColorModel model,
                      byte[] pixels,
                      int off,
                      int scansize) 
           注意:此方法旨在由Image对其像素进行过滤的ImageProducer的Image调用。 使用此类过滤图像中的像素的开发人员应避免直接调用此方法,因为该操作可能会干扰过滤操作。 
setPixels在接口 
            ImageConsumer 
           setPixels在 
            ImageFilter 
           x - 要设置的像素区域的左上角的X坐标 
           y - 要设置的像素区域的左上角的Y坐标 
           w - 像素面积的宽度 
           h - 像素面积的高度 
           model - 指定的 
            ColorModel 
           pixels - 像素数组 
           off - 偏移到 
            pixels数组 
           scansize - 
            pixels阵列中从一行像素到下一行的距离 
           ColorModel.getRGBdefault() , 
            filterRGBPixels(int, int, int, int, int[], int, int) 
           public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      ColorModel model,
                      int[] pixels,
                      int off,
                      int scansize) 
           注意:此方法的目的是由ImageProducer的Image其像素进行过滤。 使用此类过滤图像中的像素的开发人员应避免直接调用此方法,因为该操作可能会干扰过滤操作。 
setPixels在接口 
            ImageConsumer 
           setPixels在 
            ImageFilter 
           x - 要设置的像素区域的左上角的X坐标 
           y - 要设置的像素区域的左上角的Y坐标 
           w - 像素面积的宽度 
           h - 像素面积的高度 
           model - 指定的 
            ColorModel 
           pixels - 像素数组 
           off - 偏移到 
            pixels数组 
           scansize - 
            pixels数组中从一行像素到下一行的距离 
           ColorModel.getRGBdefault() , 
            filterRGBPixels(int, int, int, int, int[], int, int) 
           public abstract int filterRGB(int x,
                              int y,
                              int rgb) 
          x - 像素的X坐标 
           y - 像素的Y坐标 
           rgb - 默认RGB颜色模型中的整数像素表示 
           ColorModel.getRGBdefault() , 
            filterRGBPixels(int, int, int, int, int[], int, int) 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.