Package ca.cgjennings.graphics.filters
Class TintFilter
- java.lang.Object
-
- 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TintFilter.ScaledTintFilter
ATintFilter
that scales its saturation and brightness.
-
Field Summary
-
Fields inherited from class ca.cgjennings.graphics.filters.AbstractTintingFilter
bFactor, hFactor, sFactor
-
-
Constructor Summary
Constructors Constructor Description TintFilter()
TintFilter(float h, float s, float b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
adjustColor(int argb)
void
filterPixels(int[] argb, int start, int end)
This method is called with a block of ARGB values to be filtered.boolean
isIdentity()
Returnstrue
if applying this filter would have no effect.void
setFactors(float h, float s, float b)
Sets the hue, saturation, and brightness factors to use for tinting.-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractTintingFilter
getBFactor, getHFactor, getSFactor, setBFactor, setHFactor, setSFactor
-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractPixelwiseFilter
filter, filter, filterPixel, workFactor
-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractImageFilter
clamp, clamp, clamp, clampBoth, createCompatibleDestImage, fA, fB, fG, fR, getARGB, getARGB, getARGBSynch, getBounds2D, getPoint2D, getRenderingHints, iA, iB, iG, iR, setARGB, setARGB, setARGBSynch
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.awt.image.BufferedImageOp
createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints
-
Methods inherited from interface ca.cgjennings.graphics.filters.TintingFilter
filter
-
-
-
-
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 interfaceTintingFilter
- Overrides:
setFactors
in classTintOverlayFilter
- Parameters:
h
- the hue factors
- the saturation factorb
- 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 rangeargb[start] ... argb[end-1]
with the filtered value.- Overrides:
filterPixels
in classTintOverlayFilter
- Parameters:
argb
- an array of pixel data to filterstart
- the index of the first pixel to filterend
- the index of the last pixel to filter, plus one
-
isIdentity
public boolean isIdentity()
Description copied from interface:TintingFilter
Returnstrue
if applying this filter would have no effect. This can be used as an optimization hint.- Specified by:
isIdentity
in interfaceTintingFilter
- Overrides:
isIdentity
in classTintOverlayFilter
- Returns:
true
if a filtered image would not change
-
-