Class AlphaStrengthenFilter

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

    public final class AlphaStrengthenFilter
    extends AbstractPixelwiseFilter
    A filter that increases the overall opacity of an image. The effect is similar to painting the source image overtop of itself a number of times equal to the filter strength.

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

    Since:
    3.0
    Author:
    Chris Jennings
    • Constructor Detail

      • AlphaStrengthenFilter

        public AlphaStrengthenFilter()
      • AlphaStrengthenFilter

        public AlphaStrengthenFilter​(int strength)
    • Method Detail

      • getStrengthFactor

        public int getStrengthFactor()
      • setStrengthFactor

        public void setStrengthFactor​(int strength)
        Sets the strength of the effect. A strength of zero will result in the filter having no effect. Higher values will result in translucent pixels becoming successively more opaque, although completely transparent pixels (alpha == 0) are never affected.
        Parameters:
        strength -
      • filter

        public java.awt.image.BufferedImage filter​(java.awt.image.BufferedImage src,
                                                   java.awt.image.BufferedImage dest)
        Specified by:
        filter in interface java.awt.image.BufferedImageOp
        Overrides:
        filter in class AbstractPixelwiseFilter
      • 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
      • filterPixel

        public int filterPixel​(int argb)
        Description copied from class: AbstractPixelwiseFilter
        Returns the result of applying the filter to a single ARGB pixel value.

        The base class implementation creates a singleton array containing the pixel value and passes this to AbstractPixelwiseFilter.filterPixels(int[], int, int), returning the result. Subclasses may wish override this to provide a more efficient implementation.

        Overrides:
        filterPixel in class AbstractPixelwiseFilter
        Parameters:
        argb - the pixel value to filter
        Returns:
        the filtered pixel value