com.jhlabs.image

Class RippleFilter

Implemented Interfaces:
BufferedImageOp, Cloneable

public class RippleFilter
extends TransformFilter

A filter which distorts an image by rippling it in the X or Y directions. The amplitude and wavelength of rippling can be specified as well as whether pixels going off the edges are wrapped or not.

Field Summary

static int
NOISE
Noise ripples.
static int
SAWTOOTH
Sawtooth wave ripples.
static int
SINE
Sine wave ripples.
static int
TRIANGLE
Triangle wave ripples.

Fields inherited from class com.jhlabs.image.TransformFilter

BILINEAR, CLAMP, NEAREST_NEIGHBOUR, RGB_CLAMP, WRAP, ZERO, edgeAction, interpolation, originalSpace, transformedSpace

Constructor Summary

RippleFilter()
Construct a RippleFilter.

Method Summary

int
getWaveType()
Get the wave type.
float
getXAmplitude()
Get the amplitude of ripple in the X direction.
float
getXWavelength()
Get the wavelength of ripple in the X direction.
float
getYAmplitude()
Get the amplitude of ripple in the Y direction.
float
getYWavelength()
Get the wavelength of ripple in the Y direction.
void
setWaveType(int waveType)
Set the wave type.
void
setXAmplitude(float xAmplitude)
Set the amplitude of ripple in the X direction.
void
setXWavelength(float xWavelength)
Set the wavelength of ripple in the X direction.
void
setYAmplitude(float yAmplitude)
Set the amplitude of ripple in the Y direction.
void
setYWavelength(float yWavelength)
Set the wavelength of ripple in the Y direction.
String
toString()
protected void
transformInverse(int x, int y, float[] out)
Inverse transform a point.
protected void
transformSpace(Rectangle r)
Forward transform a rectangle.

Methods inherited from class com.jhlabs.image.TransformFilter

filter, filterPixelsNN, getEdgeAction, getInterpolation, setEdgeAction, setInterpolation, transformInverse, transformSpace

Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp

clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRGB, getRenderingHints, setRGB

Field Details

NOISE

public static final int NOISE
Noise ripples.
Field Value:
3

SAWTOOTH

public static final int SAWTOOTH
Sawtooth wave ripples.
Field Value:
1

SINE

public static final int SINE
Sine wave ripples.
Field Value:
0

TRIANGLE

public static final int TRIANGLE
Triangle wave ripples.
Field Value:
2

Constructor Details

RippleFilter

public RippleFilter()
Construct a RippleFilter.

Method Details

getWaveType

public int getWaveType()
Get the wave type.
Returns:
the type.

getXAmplitude

public float getXAmplitude()
Get the amplitude of ripple in the X direction.
Returns:
the amplitude (in pixels).

getXWavelength

public float getXWavelength()
Get the wavelength of ripple in the X direction.
Returns:
the wavelength (in pixels).

getYAmplitude

public float getYAmplitude()
Get the amplitude of ripple in the Y direction.
Returns:
the amplitude (in pixels).

getYWavelength

public float getYWavelength()
Get the wavelength of ripple in the Y direction.
Returns:
the wavelength (in pixels).

setWaveType

public void setWaveType(int waveType)
Set the wave type.
Parameters:
waveType - the type.

setXAmplitude

public void setXAmplitude(float xAmplitude)
Set the amplitude of ripple in the X direction.
Parameters:
xAmplitude - the amplitude (in pixels).

setXWavelength

public void setXWavelength(float xWavelength)
Set the wavelength of ripple in the X direction.
Parameters:
xWavelength - the wavelength (in pixels).

setYAmplitude

public void setYAmplitude(float yAmplitude)
Set the amplitude of ripple in the Y direction.
Parameters:
yAmplitude - the amplitude (in pixels).

setYWavelength

public void setYWavelength(float yWavelength)
Set the wavelength of ripple in the Y direction.
Parameters:
yWavelength - the wavelength (in pixels).

toString

public String toString()

transformInverse

protected void transformInverse(int x,
                                int y,
                                float[] out)
Inverse transform a point. This method needs to be overriden by all subclasses.
Overrides:
transformInverse in interface 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

transformSpace

protected void transformSpace(Rectangle r)
Forward transform a rectangle. Used to determine the size of the output image.
Overrides:
transformSpace in interface TransformFilter
Parameters: