Class ClearFilter

  • All Implemented Interfaces:
    java.awt.image.BufferedImageOp

    public class ClearFilter
    extends AbstractPixelwiseFilter
    Sets every pixel in an image to a single ARGB value. The new value is not mixed or painted onto the destination image, but set explicitly. To apply a solid color without disturbing the alpha channel, use a ColorOverlayFilter.

    In-place filtering: This class supports in-place filtering (the source and destination images may be the same).

    Author:
    Chris Jennings
    • Constructor Detail

      • ClearFilter

        public ClearFilter()
        Creates a filter that fills in 0x00000000.
      • ClearFilter

        public ClearFilter​(int argb)
        Creates a filter that fills in the specified ARGB value.
        Parameters:
        argb -
      • ClearFilter

        public ClearFilter​(java.awt.Color c)
        Creates a filter that uses the ARGB value specified by a Color instance.
        Parameters:
        c - the color to obtain an ARGB value from
    • Method Detail

      • getColorRGB

        public int getColorRGB()
        Returns the current fill colour as an ARGB value. This can be converted to a Color, if required, using code like the following: new Color( this.getColorRGB(), true ).
        Returns:
        the ARGB (sRGB) value of the fill colour
      • setColorRGB

        public void setColorRGB​(int argb)
        Sets the current fill colour from an ARGB value.
        Parameters:
        argb - the new colour value in 0xAARRGGBB format
      • filterPixels

        public void filterPixels​(int[] argb,
                                 int start,
                                 int end)
        Description copied from class: AbstractPixelwiseFilter
        This method is called with a block of ARGB values to be filtered. Subclasses must override this method to implement the actual filtering algorithm by replacing each pixel value in the range argb[start] ... argb[end-1] with the filtered value.
        Specified by:
        filterPixels in class AbstractPixelwiseFilter
        Parameters:
        argb - an array of pixel data to filter
        start - the index of the first pixel to filter
        end - the index of the last pixel to filter, plus one