Class TintFilter

  • All Implemented Interfaces:
    TintingFilter, java.awt.image.BufferedImageOp
    Direct Known Subclasses:
    ShiftHReplaceSBFilter, TintFilter.ScaledTintFilter

    public class TintFilter
    extends TintOverlayFilter
    A basic, general purpose card tinting filter. It shifts hue, and scales saturation and brightness of the pixels in the source image.

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

    Author:
    Chris Jennings
    • Constructor Detail

      • TintFilter

        public TintFilter()
      • TintFilter

        public TintFilter​(float h,
                          float s,
                          float b)
    • Method Detail

      • setFactors

        public void setFactors​(float h,
                               float s,
                               float b)
        Description copied from class: AbstractTintingFilter
        Sets the hue, saturation, and brightness factors to use for tinting.

        Implementation Note: if saturation or brightness are less than 0, they are clamped to 0. Values over 1 are not clamped. If your subclass requires that saturation or brightness are clamped at 1, override this method to do so, then call the super implementation.

        Specified by:
        setFactors in interface TintingFilter
        Overrides:
        setFactors in class TintOverlayFilter
        Parameters:
        h - the hue factor
        s - the saturation factor
        b - the brightness factor
      • adjustColor

        public int adjustColor​(int argb)
      • 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.
        Overrides:
        filterPixels in class TintOverlayFilter
        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
      • isIdentity

        public boolean isIdentity()
        Description copied from interface: TintingFilter
        Returns true if applying this filter would have no effect. This can be used as an optimization hint.
        Specified by:
        isIdentity in interface TintingFilter
        Overrides:
        isIdentity in class TintOverlayFilter
        Returns:
        true if a filtered image would not change