Package com.jhlabs.image
Class DisplaceFilter
java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.TransformFilter
com.jhlabs.image.DisplaceFilter
- All Implemented Interfaces:
BufferedImageOp,Cloneable
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, RGB_CLAMP, transformedSpace, WRAP, ZERO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfilter(BufferedImage src, BufferedImage dst) floatGet the amount of distortion.Get the displacement map.voidsetAmount(float amount) Set the amount of distortion.voidsetDisplacementMap(BufferedImage displacementMap) Set the displacement map.toString()protected voidtransformInverse(int x, int y, float[] out) Inverse transform a point.Methods inherited from class com.jhlabs.image.TransformFilter
filterPixelsNN, getEdgeAction, getInterpolation, setEdgeAction, setInterpolation, transformSpaceMethods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB
-
Constructor Details
-
DisplaceFilter
public DisplaceFilter()
-
-
Method Details
-
setDisplacementMap
Set the displacement map.- Parameters:
displacementMap- an image representing the displacment at each point- See Also:
-
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
- Specified by:
filterin interfaceBufferedImageOp- Overrides:
filterin classTransformFilter
-
transformInverse
protected void transformInverse(int x, int y, float[] out) Description copied from class:TransformFilterInverse transform a point. This method needs to be overriden by all subclasses.- Specified by:
transformInversein classTransformFilter- Parameters:
x- the X position of the pixel in the output imagey- the Y position of the pixel in the output imageout- the position of the pixel in the input image
-
toString
-