| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.image.ImageFilter
java.awt.image.RGBImageFilter
public abstract class RGBImageFilter
此类提供一种便捷方式创建 ImageFilter,创建的 ImageFilter 可修改使用默认 RGB ColorModel 图像的像素。这意味着要与 FilteredImageSource 对象结合使用来生成现有图像的过滤形式。该类是一个抽象类,它提供引导所有像素数据通过单独某个方法所需的调用,其中,无论 ImageProducer 正使用何种 ColorModel,该方法每次都会转换默认 RGB ColorModel 中的一个像素。创建可用图像过滤器需要定义的惟一方法是 filterRGB 方法。以下是定义交换图像中红色分量和蓝色分量过滤器的一个例子:
        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));
            }
        }
 
FilteredImageSource, 
ImageFilter, 
ColorModel.getRGBdefault()| 字段摘要 | |
|---|---|
| protected  boolean | canFilterIndexColorModel此布尔值指示是否可以接受用 filterRGB 方法的颜色过滤替代逐像素过滤,并应用于 IndexColorModel 对象的颜色表项。 | 
| protected  ColorModel | newmodel用户调用 substituteColorModel时替换origmodel的ColorModel。 | 
| protected  ColorModel | origmodel用户调用 substituteColorModel时将由newmodel替换的ColorModel。 | 
| 从类 java.awt.image.ImageFilter 继承的字段 | 
|---|
| consumer | 
| 从接口 java.awt.image.ImageConsumer 继承的字段 | 
|---|
| COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT | 
| 构造方法摘要 | |
|---|---|
| RGBImageFilter() | |
| 方法摘要 | |
|---|---|
|  IndexColorModel | filterIndexColorModel(IndexColorModel icm)过滤 IndexColorModel 对象:通过 filterRGB 函数(RGBImageFilter 子类必须提供该函数)运行该对象颜色表中的每一项。 | 
| 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)过滤缓冲区中使用默认 RGB ColorModel 的像素:将其一个接一个地传递给 filterRGB 方法。 | 
|  void | setColorModel(ColorModel model)如果 ColorModel 是 IndexColorModel 且子类将 canFilterIndexColorModel 标志设置为 true,则将此处及 setPixels 方法中任何出现原始 ColorModel 对象的地方替换为过滤后的颜色模型。 | 
|  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 对象。 | 
| 从类 java.awt.image.ImageFilter 继承的方法 | 
|---|
| clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setProperties | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
protected ColorModel origmodel
substituteColorModel 时将由 newmodel 替换的 ColorModel。
protected ColorModel newmodel
substituteColorModel 时替换 origmodel 的 ColorModel。
protected boolean canFilterIndexColorModel
substituteColorModel(java.awt.image.ColorModel, java.awt.image.ColorModel), 
filterRGB(int, int, int), 
IndexColorModel| 构造方法详细信息 | 
|---|
public RGBImageFilter()
| 方法详细信息 | 
|---|
public void setColorModel(ColorModel model)
注:此方法应由其像素将被过滤的 Image 的 ImageProducer 调用。使用此类过滤图像像素的开发人员应该避免直接调用此方法,因为该操作可能干扰过滤操作。
ImageConsumer 中的 setColorModelImageFilter 中的 setColorModelmodel - 指定的 ColorModelImageConsumer, 
ColorModel.getRGBdefault()
public void substituteColorModel(ColorModel oldcm,
                                 ColorModel newcm)
oldcm - 要被动态替换的 ColorModel 对象newcm - 要动态替换 oldcm 的 ColorModel 对象public IndexColorModel filterIndexColorModel(IndexColorModel icm)
icm - 要过滤的 IndexColorModel 对象
NullPointerException - 如果 icm 为 null
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 调用。使用此类过滤图像像素的开发人员应该避免直接调用此方法,因为该操作可能干扰过滤操作。
ImageConsumer 中的 setPixelsImageFilter 中的 setPixelsx - 要设置的像素区域左上角的 X 坐标y - 要设置的像素区域左上角的 Y 坐标w - 像素区域的宽度h - 像素区域的高度model - 指定的 ColorModelpixels - 像素数组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)
注:此方法应由其像素将被过滤的 Image 的 ImageProducer 调用。使用此类过滤图像像素的开发人员应该避免直接调用此方法,因为该操作可能干扰过滤操作。
ImageConsumer 中的 setPixelsImageFilter 中的 setPixelsx - 要设置的像素区域左上角的 X 坐标y - 要设置的像素区域左上角的 Y 坐标w - 像素区域的宽度h - 像素区域的高度model - 指定的 ColorModelpixels - 像素数组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)| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。