Package com.jhlabs.image
Class BoxBlurFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.BoxBlurFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
,java.lang.Cloneable
public class BoxBlurFilter extends AbstractBufferedImageOp
A filter which performs a box blur on an image. The horizontal and vertical blurs can be specified separately and a number of iterations can be given which allows an approximation to Gaussian blur.
-
-
Constructor Summary
Constructors Constructor Description BoxBlurFilter()
Construct a default BoxBlurFilter.BoxBlurFilter(float hRadius, float vRadius, int iterations)
Construct a BoxBlurFilter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
blur(int[] in, int[] out, int width, int height, float radius)
Blur and transpose a block of ARGB pixels.static void
blurFractional(int[] in, int[] out, int width, int height, float radius)
java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
float
getHRadius()
Get the horizontal size of the blur.int
getIterations()
Get the number of iterations the blur is performed.boolean
getPremultiplyAlpha()
Get whether to premultiply the alpha channel.float
getRadius()
Get the size of the blur.float
getVRadius()
Get the vertical size of the blur.void
setHRadius(float hRadius)
Set the horizontal size of the blur.void
setIterations(int iterations)
Set the number of iterations the blur is performed.void
setPremultiplyAlpha(boolean premultiplyAlpha)
Set whether to premultiply the alpha channel.void
setRadius(float radius)
Set both the horizontal and vertical sizes of the blur.void
setVRadius(float vRadius)
Set the vertical size of the blur.java.lang.String
toString()
-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB, stringToColor
-
-
-
-
Constructor Detail
-
BoxBlurFilter
public BoxBlurFilter()
Construct a default BoxBlurFilter.
-
BoxBlurFilter
public BoxBlurFilter(float hRadius, float vRadius, int iterations)
Construct a BoxBlurFilter.- Parameters:
hRadius
- the horizontal radius of blurvRadius
- the vertical radius of bluriterations
- the number of time to iterate the blur
-
-
Method Detail
-
setPremultiplyAlpha
public void setPremultiplyAlpha(boolean premultiplyAlpha)
Set whether to premultiply the alpha channel.- Parameters:
premultiplyAlpha
- true to premultiply the alpha- See Also:
getPremultiplyAlpha()
-
getPremultiplyAlpha
public boolean getPremultiplyAlpha()
Get whether to premultiply the alpha channel.- Returns:
- true to premultiply the alpha
- See Also:
setPremultiplyAlpha(boolean)
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
-
blur
public static void blur(int[] in, int[] out, int width, int height, float radius)
Blur and transpose a block of ARGB pixels.- Parameters:
in
- the input pixelsout
- the output pixelswidth
- the width of the pixel arrayheight
- the height of the pixel arrayradius
- the radius of blur
-
blurFractional
public static void blurFractional(int[] in, int[] out, int width, int height, float radius)
-
setHRadius
public void setHRadius(float hRadius)
Set the horizontal size of the blur.- Parameters:
hRadius
- the radius of the blur in the horizontal direction, min-value 0- See Also:
getHRadius()
-
getHRadius
public float getHRadius()
Get the horizontal size of the blur.- Returns:
- the radius of the blur in the horizontal direction
- See Also:
setHRadius(float)
-
setVRadius
public void setVRadius(float vRadius)
Set the vertical size of the blur.- Parameters:
vRadius
- the radius of the blur in the vertical direction, min-value 0- See Also:
getVRadius()
-
getVRadius
public float getVRadius()
Get the vertical size of the blur.- Returns:
- the radius of the blur in the vertical direction
- See Also:
setVRadius(float)
-
setRadius
public void setRadius(float radius)
Set both the horizontal and vertical sizes of the blur.- Parameters:
radius
- the radius of the blur in both directions, min-value 0- See Also:
getRadius()
-
getRadius
public float getRadius()
Get the size of the blur.- Returns:
- the radius of the blur in the horizontal direction
- See Also:
setRadius(float)
-
setIterations
public void setIterations(int iterations)
Set the number of iterations the blur is performed.- Parameters:
iterations
- the number of iterations, min-value 0- See Also:
getIterations()
-
getIterations
public int getIterations()
Get the number of iterations the blur is performed.- Returns:
- the number of iterations
- See Also:
setIterations(int)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-