Package ca.cgjennings.graphics.filters
Class SharpenFilter
- java.lang.Object
-
- ca.cgjennings.graphics.filters.AbstractImageFilter
-
- ca.cgjennings.graphics.filters.AbstractImagewiseFilter
-
- ca.cgjennings.graphics.filters.AbstractConvolver
-
- ca.cgjennings.graphics.filters.SharpenFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
public final class SharpenFilter extends AbstractConvolver
A filter that sharpens the input image.In-place filtering: This class allows in-place filtering (the source and destination images can be the same).
- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description SharpenFilter()
Creates a new sharpening filter with a sharpening factor of 1.SharpenFilter(float sharpeningFactor)
Creates a new sharpening filter with the specified sharpening factor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.image.Kernel[]
getKernels()
Returns the convolution kernel(s) that should be applied to execute this filter.float
getSharpeningFactor()
Returns a factor representing the amount of sharpening that will be applied by this filter.void
setSharpeningFactor(float sharpeningFactor)
Sets the sharpening factor.-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractConvolver
filter, filterPixels, getEdgeHandling, isAlphaFiltered, isAlphaPremultiplied, workFactor
-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractImagewiseFilter
filter
-
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
-
-
-
-
Method Detail
-
getSharpeningFactor
public float getSharpeningFactor()
Returns a factor representing the amount of sharpening that will be applied by this filter.- Returns:
- the sharpening factor
-
setSharpeningFactor
public void setSharpeningFactor(float sharpeningFactor)
Sets the sharpening factor. Higher values increase the sharpening effect. Lower values produce a less pronounced sharpening effect. A value of zero will reproduce the original image (some pixel values may change slightly due to rounding and conversion errors). The default is factor is one.- Parameters:
sharpeningFactor
- a factor which determines how pronounced the sharpening effect is- Throws:
java.lang.IllegalArgumentException
- if the sharpening factor is negative
-
getKernels
protected java.awt.image.Kernel[] getKernels()
Description copied from class:AbstractConvolver
Returns the convolution kernel(s) that should be applied to execute this filter. Typically, array is either length one (non-separable) or length two (separable).- Specified by:
getKernels
in classAbstractConvolver
- Returns:
- an array of non-
null
convolution kernels
-
-