com.jhlabs.image

Class VariableBlurFilter

Implemented Interfaces:
BufferedImageOp, 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.

Method Summary

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.
BufferedImage
createCompatibleDestImage(BufferedImage src, ColorModel dstCM)
BufferedImage
filter(BufferedImage src, BufferedImage dst)
BufferedImage
getBlurMask()
Get the mask used to give the amount of blur at each point.
Rectangle2D
getBounds2D(BufferedImage src)
int
getHRadius()
Get the horizontal size of the blur.
int
getIterations()
Get the number of iterations the blur is performed.
Point2D
getPoint2D(Point2D srcPt, Point2D dstPt)
boolean
getPremultiplyAlpha()
Get whether to premultiply the alpha channel.
int
getRadius()
Get the radius of the effect.
RenderingHints
getRenderingHints()
int
getVRadius()
Get the vertical size of the blur.
void
setBlurMask(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.
String
toString()

Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp

clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRGB, getRenderingHints, setRGB

Method Details

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 coordinate
y - the y coordinate
width - the width of the image
height - the height of the image
Returns:
the blur radius

createCompatibleDestImage

public BufferedImage createCompatibleDestImage(BufferedImage src,
                                               ColorModel dstCM)
Overrides:
createCompatibleDestImage in interface AbstractBufferedImageOp

filter

public BufferedImage filter(BufferedImage src,
                            BufferedImage dst)

getBlurMask

public BufferedImage getBlurMask()
Get the mask used to give the amount of blur at each point.
Returns:
the mask

getBounds2D

public Rectangle2D getBounds2D(BufferedImage src)
Overrides:
getBounds2D in interface AbstractBufferedImageOp

getHRadius

public int getHRadius()
Get the horizontal size of the blur.
Returns:
the radius of the blur in the horizontal direction

getIterations

public int getIterations()
Get the number of iterations the blur is performed.
Returns:
the number of iterations

getPoint2D

public Point2D getPoint2D(Point2D srcPt,
                          Point2D dstPt)
Overrides:
getPoint2D in interface AbstractBufferedImageOp

getPremultiplyAlpha

public boolean getPremultiplyAlpha()
Get whether to premultiply the alpha channel.
Returns:
true to premultiply the alpha

getRadius

public int getRadius()
Get the radius of the effect.
Returns:
the radius

getRenderingHints

public RenderingHints getRenderingHints()
Overrides:
getRenderingHints in interface AbstractBufferedImageOp

getVRadius

public int getVRadius()
Get the vertical size of the blur.
Returns:
the radius of the blur in the vertical direction

setBlurMask

public void setBlurMask(BufferedImage blurMask)
Set the mask used to give the amount of blur at each point.
Parameters:
blurMask - the mask

setHRadius

public void setHRadius(int hRadius)
Set the horizontal size of the blur.
Parameters:
hRadius - the radius of the blur in the horizontal direction

setIterations

public void setIterations(int iterations)
Set the number of iterations the blur is performed.
Parameters:
iterations - the number of iterations

setPremultiplyAlpha

public void setPremultiplyAlpha(boolean premultiplyAlpha)
Set whether to premultiply the alpha channel.
Parameters:
premultiplyAlpha - true to premultiply the alpha

setRadius

public void setRadius(int radius)
Set the radius of the effect.
Parameters:
radius - the radius

setVRadius

public void setVRadius(int vRadius)
Set the vertical size of the blur.
Parameters:
vRadius - the radius of the blur in the vertical direction

toString

public String toString()