A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.oracle.com/en/java/javase/19/docs/api/java.desktop/java/awt/image/RGBImageFilter.html below:

RGBImageFilter (Java SE 19 & JDK 19)

All Implemented Interfaces:
ImageConsumer, Cloneable
Direct Known Subclasses:
GrayFilter
public abstract class RGBImageFilter extends ImageFilter

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:



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

 
See Also:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4