Package com.jhlabs.image
Class GaussianFilter
java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.ConvolveFilter
com.jhlabs.image.GaussianFilter
- All Implemented Interfaces:
BufferedImageOp
,Cloneable
- Direct Known Subclasses:
GlowFilter
,HighPassFilter
,UnsharpFilter
A filter which applies Gaussian blur to an image. This is a subclass of ConvolveFilter
which simply creates a kernel with a Gaussian distribution for blurring.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Kernel
The convolution kernel.protected float
The blur radius.Fields inherited from class com.jhlabs.image.ConvolveFilter
alpha, CLAMP_EDGES, premultiplyAlpha, WRAP_EDGES, ZERO_EDGES
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a Gaussian filter.GaussianFilter
(float radius) Construct a Gaussian filter. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
convolveAndTranspose
(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, boolean premultiply, boolean unpremultiply, int edgeAction) Blur and transpose a block of ARGB pixels.filter
(BufferedImage src, BufferedImage dst) float
Get the radius of the kernel.static Kernel
makeKernel
(float radius) Make a Gaussian blur kernel.void
setRadius
(float radius) Set the radius of the kernel, and hence the amount of blur.toString()
Methods inherited from class com.jhlabs.image.ConvolveFilter
convolve, convolve, convolveH, convolveHV, convolveV, createCompatibleDestImage, getBounds2D, getEdgeAction, getKernel, getPoint2D, getPremultiplyAlpha, getRenderingHints, getUseAlpha, setEdgeAction, setKernel, setPremultiplyAlpha, setUseAlpha
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, getRGB, setRGB
-
Field Details
-
radius
protected float radiusThe blur radius. -
kernel
The convolution kernel.
-
-
Constructor Details
-
GaussianFilter
public GaussianFilter()Construct a Gaussian filter. -
GaussianFilter
public GaussianFilter(float radius) Construct a Gaussian filter.- Parameters:
radius
- blur radius in pixels
-
-
Method Details
-
setRadius
public void setRadius(float radius) Set the radius of the kernel, and hence the amount of blur. The bigger the radius, the longer this filter will take.- Parameters:
radius
- the radius of the blur in pixels.- See Also:
-
getRadius
public float getRadius()Get the radius of the kernel.- Returns:
- the radius
- See Also:
-
filter
- Specified by:
filter
in interfaceBufferedImageOp
- Overrides:
filter
in classConvolveFilter
-
convolveAndTranspose
public static void convolveAndTranspose(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, boolean premultiply, boolean unpremultiply, int edgeAction) Blur and transpose a block of ARGB pixels.- Parameters:
kernel
- the blur kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the width of the pixel arrayheight
- the height of the pixel arrayalpha
- whether to blur the alpha channeledgeAction
- what to do at the edges
-
makeKernel
Make a Gaussian blur kernel.- Parameters:
radius
- the blur radius- Returns:
- the kernel
-
toString
- Overrides:
toString
in classConvolveFilter
-