Class DisplaceFilter

All Implemented Interfaces:
BufferedImageOp, Cloneable

public class DisplaceFilter extends TransformFilter
A filter which simulates the appearance of looking through glass. A separate grayscale displacement image is provided and pixels in the source image are displaced according to the gradient of the displacement map.
  • Constructor Details

    • DisplaceFilter

      public DisplaceFilter()
  • Method Details

    • setDisplacementMap

      public void setDisplacementMap(BufferedImage displacementMap)
      Set the displacement map.
      Parameters:
      displacementMap - an image representing the displacment at each point
      See Also:
    • getDisplacementMap

      public BufferedImage getDisplacementMap()
      Get the displacement map.
      Returns:
      an image representing the displacment at each point
      See Also:
    • setAmount

      public void setAmount(float amount)
      Set the amount of distortion.
      Parameters:
      amount - the amount
      See Also:
    • getAmount

      public float getAmount()
      Get the amount of distortion.
      Returns:
      the amount
      See Also:
    • filter

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

      protected void transformInverse(int x, int y, float[] out)
      Description copied from class: TransformFilter
      Inverse transform a point. This method needs to be overriden by all subclasses.
      Specified by:
      transformInverse in class TransformFilter
      Parameters:
      x - the X position of the pixel in the output image
      y - the Y position of the pixel in the output image
      out - the position of the pixel in the input image
    • toString

      public String toString()
      Overrides:
      toString in class Object