Package ca.cgjennings.graphics.filters
Class TintOverlayFilter
- java.lang.Object
-
- ca.cgjennings.graphics.filters.AbstractImageFilter
-
- ca.cgjennings.graphics.filters.AbstractPixelwiseFilter
-
- ca.cgjennings.graphics.filters.AbstractTintingFilter
-
- ca.cgjennings.graphics.filters.TintOverlayFilter
-
- All Implemented Interfaces:
TintingFilter
,java.awt.image.BufferedImageOp
- Direct Known Subclasses:
TintFilter
public class TintOverlayFilter extends AbstractTintingFilter
This filter changes the colour of every pixel to an HSB colour value, but leaves the alpha value untouched.
-
-
Field Summary
-
Fields inherited from class ca.cgjennings.graphics.filters.AbstractTintingFilter
bFactor, hFactor, sFactor
-
-
Constructor Summary
Constructors Constructor Description TintOverlayFilter()
TintOverlayFilter(float h, float s, float b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 classAbstractTintingFilter
- Parameters:
h
- the hue factors
- the saturation factorb
- the brightness factor
-
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.- Specified by:
filterPixels
in classAbstractPixelwiseFilter
- 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 classAbstractTintingFilter
- Returns:
true
if a filtered image would not change
-
-