Package com.jhlabs.image
Class WarpFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.WholeImageFilter
-
- com.jhlabs.image.WarpFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp,java.lang.Cloneable
public class WarpFilter extends WholeImageFilter
A filter for warping images using the gridwarp algorithm. You need to supply two warp grids, one for the source image and one for the destination image. The image will be warped so that a point in the source grid moves to its counterpart in the destination grid.
-
-
Field Summary
-
Fields inherited from class com.jhlabs.image.WholeImageFilter
originalSpace, transformedSpace
-
-
Constructor Summary
Constructors Constructor Description WarpFilter()Create a WarpFilter.WarpFilter(WarpGrid sourceGrid, WarpGrid destGrid)Create a WarpFilter with two warp grids.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcrossDissolve(int[] pixels1, int[] pixels2, int width, int height, float t)protected int[]filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)Actually filter the pixels.WarpGridgetDestGrid()Get the destination warp grid.intgetFrames()java.awt.image.BufferedImagegetMorphImage()WarpGridgetSourceGrid()Get the source warp grid.floatgetTime()voidmorph(int[] srcPixels, int[] destPixels, int[] outPixels, WarpGrid srcGrid, WarpGrid destGrid, int width, int height, float t)voidsetDestGrid(WarpGrid destGrid)Set the destination warp grid.voidsetFrames(int frames)voidsetMorphImage(java.awt.image.BufferedImage morphImage)For morphing, sets the image we're morphing to.voidsetSourceGrid(WarpGrid sourceGrid)Set the source warp grid.voidsetTime(float time)java.lang.StringtoString()protected voidtransformSpace(java.awt.Rectangle r)Calculate output bounds for given input bounds.-
Methods inherited from class com.jhlabs.image.WholeImageFilter
filter
-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB, stringToColor
-
-
-
-
Method Detail
-
setSourceGrid
public void setSourceGrid(WarpGrid sourceGrid)
Set the source warp grid.- Parameters:
sourceGrid- the source grid- See Also:
getSourceGrid()
-
getSourceGrid
public WarpGrid getSourceGrid()
Get the source warp grid.- Returns:
- the source grid
- See Also:
setSourceGrid(com.jhlabs.image.WarpGrid)
-
setDestGrid
public void setDestGrid(WarpGrid destGrid)
Set the destination warp grid.- Parameters:
destGrid- the destination grid- See Also:
getDestGrid()
-
getDestGrid
public WarpGrid getDestGrid()
Get the destination warp grid.- Returns:
- the destination grid
- See Also:
setDestGrid(com.jhlabs.image.WarpGrid)
-
setFrames
public void setFrames(int frames)
-
getFrames
public int getFrames()
-
setMorphImage
public void setMorphImage(java.awt.image.BufferedImage morphImage)
For morphing, sets the image we're morphing to. If not, set then we're just warping.- Parameters:
morphImage- The image to be morphed or warped.
-
getMorphImage
public java.awt.image.BufferedImage getMorphImage()
-
setTime
public void setTime(float time)
-
getTime
public float getTime()
-
transformSpace
protected void transformSpace(java.awt.Rectangle r)
Description copied from class:WholeImageFilterCalculate output bounds for given input bounds.- Overrides:
transformSpacein classWholeImageFilter- Parameters:
r- input and output rectangle
-
filterPixels
protected int[] filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)Description copied from class:WholeImageFilterActually filter the pixels.- Specified by:
filterPixelsin classWholeImageFilter- Parameters:
width- the image widthheight- the image heightinPixels- the image pixelstransformedSpace- the output bounds- Returns:
- the output pixels
-
morph
public void morph(int[] srcPixels, int[] destPixels, int[] outPixels, WarpGrid srcGrid, WarpGrid destGrid, int width, int height, float t)
-
crossDissolve
public void crossDissolve(int[] pixels1, int[] pixels2, int width, int height, float t)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-