Class VariableBlurFilter

java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.VariableBlurFilter
All 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.
  • Constructor Details

    • VariableBlurFilter

      public VariableBlurFilter()
  • Method Details

    • setPremultiplyAlpha

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

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

      public BufferedImage filter(BufferedImage src, BufferedImage dst)
    • createCompatibleDestImage

      public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM)
      Specified by:
      createCompatibleDestImage in interface BufferedImageOp
      Overrides:
      createCompatibleDestImage in class AbstractBufferedImageOp
    • getBounds2D

      public Rectangle2D getBounds2D(BufferedImage src)
      Specified by:
      getBounds2D in interface BufferedImageOp
      Overrides:
      getBounds2D in class AbstractBufferedImageOp
    • getPoint2D

      public Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
      Specified by:
      getPoint2D in interface BufferedImageOp
      Overrides:
      getPoint2D in class AbstractBufferedImageOp
    • getRenderingHints

      public RenderingHints getRenderingHints()
      Specified by:
      getRenderingHints in interface BufferedImageOp
      Overrides:
      getRenderingHints in class AbstractBufferedImageOp
    • 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
    • setHRadius

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

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

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

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

      public void setRadius(int radius)
      Set the radius of the effect.
      Parameters:
      radius - the radius
      See Also:
    • getRadius

      public int getRadius()
      Get the radius of the effect.
      Returns:
      the radius
      See Also:
    • setIterations

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

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

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

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

      public String toString()
      Overrides:
      toString in class Object