Package com.jhlabs.image
Class VariableBlurFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.VariableBlurFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
,java.lang.Cloneable
public class VariableBlurFilter extends AbstractBufferedImageOp
A filter which performs a box blur with a different blur radius at each pixel. The radius can either be specified by providing a blur mask image or by overriding the blurRadiusAt method.
-
-
Constructor Summary
Constructors Constructor Description VariableBlurFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
blur(int[] in, int[] out, int width, int height, int radius, int pass)
protected float
blurRadiusAt(int x, int y, int width, int height)
Override this to get a different blur radius at eahc point.java.awt.image.BufferedImage
createCompatibleDestImage(java.awt.image.BufferedImage src, java.awt.image.ColorModel dstCM)
java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
java.awt.image.BufferedImage
getBlurMask()
Get the mask used to give the amount of blur at each point.java.awt.geom.Rectangle2D
getBounds2D(java.awt.image.BufferedImage src)
int
getHRadius()
Get the horizontal size of the blur.int
getIterations()
Get the number of iterations the blur is performed.java.awt.geom.Point2D
getPoint2D(java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt)
boolean
getPremultiplyAlpha()
Get whether to premultiply the alpha channel.int
getRadius()
Get the radius of the effect.java.awt.RenderingHints
getRenderingHints()
int
getVRadius()
Get the vertical size of the blur.void
setBlurMask(java.awt.image.BufferedImage blurMask)
Set the mask used to give the amount of blur at each point.void
setHRadius(int 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(int radius)
Set the radius of the effect.void
setVRadius(int vRadius)
Set the vertical size of the blur.java.lang.String
toString()
-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, getRGB, setRGB, stringToColor
-
-
-
-
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)
-
createCompatibleDestImage
public java.awt.image.BufferedImage createCompatibleDestImage(java.awt.image.BufferedImage src, java.awt.image.ColorModel dstCM)
- Specified by:
createCompatibleDestImage
in interfacejava.awt.image.BufferedImageOp
- Overrides:
createCompatibleDestImage
in classAbstractBufferedImageOp
-
getBounds2D
public java.awt.geom.Rectangle2D getBounds2D(java.awt.image.BufferedImage src)
- Specified by:
getBounds2D
in interfacejava.awt.image.BufferedImageOp
- Overrides:
getBounds2D
in classAbstractBufferedImageOp
-
getPoint2D
public java.awt.geom.Point2D getPoint2D(java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt)
- Specified by:
getPoint2D
in interfacejava.awt.image.BufferedImageOp
- Overrides:
getPoint2D
in classAbstractBufferedImageOp
-
getRenderingHints
public java.awt.RenderingHints getRenderingHints()
- Specified by:
getRenderingHints
in interfacejava.awt.image.BufferedImageOp
- Overrides:
getRenderingHints
in classAbstractBufferedImageOp
-
blur
public void blur(int[] in, int[] out, int width, int height, int radius, int pass)
-
blurRadiusAt
protected float blurRadiusAt(int x, int y, int width, int height)
Override this to get a different blur radius at eahc point.- Parameters:
x
- the x coordinatey
- the y coordinatewidth
- the width of the imageheight
- the height of the image- Returns:
- the blur radius
-
setHRadius
public void setHRadius(int hRadius)
Set the horizontal size of the blur.- Parameters:
hRadius
- the radius of the blur in the horizontal direction. Minimum value: 0- See Also:
getHRadius()
-
getHRadius
public int getHRadius()
Get the horizontal size of the blur.- Returns:
- the radius of the blur in the horizontal direction
- See Also:
setHRadius(int)
-
setVRadius
public void setVRadius(int vRadius)
Set the vertical size of the blur.- Parameters:
vRadius
- the radius of the blur in the vertical direction. Minimum value: 0.- See Also:
getVRadius()
-
getVRadius
public int getVRadius()
Get the vertical size of the blur.- Returns:
- the radius of the blur in the vertical direction
- See Also:
setVRadius(int)
-
setRadius
public void setRadius(int radius)
Set the radius of the effect.- Parameters:
radius
- the radius. Minimum value: 0- See Also:
getRadius()
-
getRadius
public int getRadius()
Get the radius of the effect.- Returns:
- the radius
- See Also:
setRadius(int)
-
setIterations
public void setIterations(int iterations)
Set the number of iterations the blur is performed.- Parameters:
iterations
- the number of iterations. Minimum 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)
-
setBlurMask
public void setBlurMask(java.awt.image.BufferedImage blurMask)
Set the mask used to give the amount of blur at each point.- Parameters:
blurMask
- the mask- See Also:
getBlurMask()
-
getBlurMask
public java.awt.image.BufferedImage getBlurMask()
Get the mask used to give the amount of blur at each point.- Returns:
- the mask
- See Also:
setBlurMask(BufferedImage)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-