com.jhlabs.image
Class DisplaceFilter

java.lang.Object
  extended by com.jhlabs.image.AbstractBufferedImageOp
      extended by com.jhlabs.image.TransformFilter
          extended by com.jhlabs.image.DisplaceFilter
All Implemented Interfaces:
java.awt.image.BufferedImageOp, java.lang.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.


Field Summary
 
Fields inherited from class com.jhlabs.image.TransformFilter
BILINEAR, CLAMP, edgeAction, interpolation, NEAREST_NEIGHBOUR, originalSpace, transformedSpace, WRAP, ZERO
 
Constructor Summary
DisplaceFilter()
           
 
Method Summary
 java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dst)
           
 float getAmount()
          Get the amount of distortion.
 java.awt.image.BufferedImage getDisplacementMap()
          Get the displacement map.
 void setAmount(float amount)
          Set the amount of distortion.
 void setDisplacementMap(java.awt.image.BufferedImage displacementMap)
          Set the displacement map.
 java.lang.String toString()
           
protected  void transformInverse(int x, int y, float[] out)
          Inverse transform a point.
 
Methods inherited from class com.jhlabs.image.TransformFilter
filterPixelsNN, getEdgeAction, getInterpolation, setEdgeAction, setInterpolation, transformSpace
 
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DisplaceFilter

public DisplaceFilter()
Method Detail

setDisplacementMap

public void setDisplacementMap(java.awt.image.BufferedImage displacementMap)
Set the displacement map.

Parameters:
displacementMap - an image representing the displacment at each point
See Also:
getDisplacementMap()

getDisplacementMap

public java.awt.image.BufferedImage getDisplacementMap()
Get the displacement map.

Returns:
an image representing the displacment at each point
See Also:
setDisplacementMap(java.awt.image.BufferedImage)

setAmount

public void setAmount(float amount)
Set the amount of distortion.

Parameters:
amount - the amount
See Also:
getAmount()

getAmount

public float getAmount()
Get the amount of distortion.

Returns:
the amount
See Also:
setAmount(float)

filter

public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src,
                                           java.awt.image.BufferedImage dst)
Specified by:
filter in interface java.awt.image.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object