Class GaussianFilter

All Implemented Interfaces:
BufferedImageOp, Cloneable
Direct Known Subclasses:
GlowFilter, UnsharpFilter

public class GaussianFilter extends ConvolveFilter
A filter which applies Gaussian blur to an image. This is a subclass of ConvolveFilter which simply creates a kernel with a Gaussian distribution for blurring.
  • Field Details

    • radius

      protected float radius
    • kernel

      protected Kernel kernel
  • Constructor Details

    • GaussianFilter

      public GaussianFilter()
      Construct a Gaussian filter
    • GaussianFilter

      public GaussianFilter(float radius)
      Construct a Gaussian filter
      Parameters:
      radius - blur radius in pixels
  • Method Details

    • setRadius

      public void setRadius(float radius)
      Set the radius of the kernel, and hence the amount of blur. The bigger the radius, the longer this filter will take.
      Parameters:
      radius - the radius of the blur in pixels.
    • getRadius

      public float getRadius()
      Get the radius of the kernel.
      Returns:
      the radius
    • filter

      public BufferedImage filter(BufferedImage src, BufferedImage dst)
      Specified by:
      filter in interface BufferedImageOp
      Overrides:
      filter in class ConvolveFilter
    • convolveAndTranspose

      public static void convolveAndTranspose(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
    • makeKernel

      public static Kernel makeKernel(float radius)
      Make a Gaussian blur kernel.
    • toString

      public String toString()
      Overrides:
      toString in class ConvolveFilter