Class AbstractFilter

  • All Implemented Interfaces:
    BufferedImageOp
    Direct Known Subclasses:
    ColorShiftFilter

    public abstract class AbstractFilter
    extends Object
    implements BufferedImageOp

    Provides an abstract implementation of the BufferedImageOp interface. This class can be used to created new image filters based on BufferedImageOp.

    • Constructor Detail

      • AbstractFilter

        public AbstractFilter()
    • Method Detail

      • getPixels

        protected int[] getPixels​(BufferedImage img,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  int[] pixels)
        Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space, from a portion of the image data.
        Parameters:
        img - Image.
        x - The starting X coordinate
        y - The starting Y coordinate
        w - Width of region.
        h - Height of region.
        pixels - If not null, the pixels are written here.
        Returns:
        Array or RGB pixels.
      • setPixels

        protected void setPixels​(BufferedImage img,
                                 int x,
                                 int y,
                                 int w,
                                 int h,
                                 int[] pixels)

        Writes a rectangular area of pixels in the destination BufferedImage. Calling this method on an image of type different from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB will unmanage the image.

        Parameters:
        img - the destination image
        x - the x location at which to start storing pixels
        y - the y location at which to start storing pixels
        w - the width of the rectangle of pixels to store
        h - the height of the rectangle of pixels to store
        pixels - an array of pixels, stored as integers
        Throws:
        IllegalArgumentException - is pixels is non-null and of length < w*h