Class StackBlurFilter
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.swingx.image.AbstractFilter
-
- org.jdesktop.swingx.image.StackBlurFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
public class StackBlurFilter extends AbstractFilter
A stack blur filter can be used to create an approximation of a Gaussian blur. The approximation is controlled by the number of times the
FastBlurFilteris applied onto the source picture. The default number of iterations, 3, provides a decent compromise between speed and rendering quality.The force of the blur can be controlled with a radius and the default radius is 3. Since the blur clamps values on the edges of the source picture, you might need to provide a picture with empty borders to avoid artifacts at the edges. The performance of this filter are independent from the radius.
-
-
Field Summary
Fields Modifier and Type Field Description private intiterationsprivate intradius
-
Constructor Summary
Constructors Constructor Description StackBlurFilter()Creates a new blur filter with a default radius of 3 and 3 iterations.StackBlurFilter(int radius)Creates a new blur filter with the specified radius and 3 iterations.StackBlurFilter(int radius, int iterations)Creates a new blur filter with the specified radius.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImagefilter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)intgetEffectiveRadius()Returns the effective radius of the stack blur.intgetIterations()Returns the number of iterations used to approximate a Gaussian blur.intgetRadius()Returns the radius used by this filter, in pixels.-
Methods inherited from class org.jdesktop.swingx.image.AbstractFilter
createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints
-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Constructor Detail
-
StackBlurFilter
public StackBlurFilter()
Creates a new blur filter with a default radius of 3 and 3 iterations.
-
StackBlurFilter
public StackBlurFilter(int radius)
Creates a new blur filter with the specified radius and 3 iterations. If the radius is lower than 1, a radius of 1 will be used automatically.
- Parameters:
radius- the radius, in pixels, of the blur
-
StackBlurFilter
public StackBlurFilter(int radius, int iterations)Creates a new blur filter with the specified radius. If the radius is lower than 1, a radius of 1 will be used automatically. The number of iterations controls the approximation to a Gaussian blur. If the number of iterations is lower than 1, one iteration will be used automatically.
- Parameters:
radius- the radius, in pixels, of the bluriterations- the number of iterations to approximate a Gaussian blur
-
-
Method Detail
-
getEffectiveRadius
public int getEffectiveRadius()
Returns the effective radius of the stack blur. If the radius of the blur is 1 and the stack iterations count is 3, then the effective blur radius is 1 * 3 = 3.
- Returns:
- the number of iterations times the blur radius
-
getRadius
public int getRadius()
Returns the radius used by this filter, in pixels.
- Returns:
- the radius of the blur
-
getIterations
public int getIterations()
Returns the number of iterations used to approximate a Gaussian blur.
- Returns:
- the number of iterations used by this blur
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)- Specified by:
filterin interfacejava.awt.image.BufferedImageOp- Specified by:
filterin classAbstractFilter
-
-