com.jhlabs.image
Class TransformFilter
- BufferedImageOp, Cloneable
public abstract class TransformFilter
An abstract superclass for filters which distort images in some way. The subclass only needs to override
two methods to provide the mapping between source and destination pixels.
static int | BILINEAR - Use bilinear interpolation.
|
static int | CLAMP - Clamp pixels to the image edges.
|
static int | NEAREST_NEIGHBOUR - Use nearest-neighbout interpolation.
|
static int | RGB_CLAMP - Clamp pixels RGB to the image edges, but zero the alpha.
|
static int | WRAP - Wrap pixels off the edge onto the oppsoite edge.
|
static int | ZERO - Treat pixels off the edge as zero.
|
protected int | edgeAction - The action to take for pixels off the image edge.
|
protected int | interpolation - The type of interpolation to use.
|
protected Rectangle | originalSpace - The input image rectangle.
|
protected Rectangle | transformedSpace - The output image rectangle.
|
BufferedImage | filter(BufferedImage src, BufferedImage dst)
|
protected BufferedImage | filterPixelsNN(BufferedImage dst, int width, int height, int[] inPixels, Rectangle transformedSpace)
|
int | getEdgeAction() - Get the action to perform for pixels off the edge of the image.
|
int | getInterpolation() - Get the type of interpolation to perform.
|
void | setEdgeAction(int edgeAction) - Set the action to perform for pixels off the edge of the image.
|
void | setInterpolation(int interpolation) - Set the type of interpolation to perform.
|
protected abstract void | transformInverse(int x, int y, float[] out) - Inverse transform a point.
|
protected void | transformSpace(Rectangle rect) - Forward transform a rectangle.
|
BILINEAR
public static final int BILINEAR
Use bilinear interpolation.
CLAMP
public static final int CLAMP
Clamp pixels to the image edges.
NEAREST_NEIGHBOUR
public static final int NEAREST_NEIGHBOUR
Use nearest-neighbout interpolation.
RGB_CLAMP
public static final int RGB_CLAMP
Clamp pixels RGB to the image edges, but zero the alpha. This prevents gray borders on your image.
WRAP
public static final int WRAP
Wrap pixels off the edge onto the oppsoite edge.
ZERO
public static final int ZERO
Treat pixels off the edge as zero.
edgeAction
protected int edgeAction
The action to take for pixels off the image edge.
interpolation
protected int interpolation
The type of interpolation to use.
originalSpace
protected Rectangle originalSpace
The input image rectangle.
transformedSpace
protected Rectangle transformedSpace
The output image rectangle.
filter
public BufferedImage filter(BufferedImage src,
BufferedImage dst)
filterPixelsNN
protected BufferedImage filterPixelsNN(BufferedImage dst,
int width,
int height,
int[] inPixels,
Rectangle transformedSpace)
getEdgeAction
public int getEdgeAction()
Get the action to perform for pixels off the edge of the image.
- one of ZERO, CLAMP or WRAP
getInterpolation
public int getInterpolation()
Get the type of interpolation to perform.
- one of NEAREST_NEIGHBOUR or BILINEAR
setEdgeAction
public void setEdgeAction(int edgeAction)
Set the action to perform for pixels off the edge of the image.
edgeAction
- one of ZERO, CLAMP or WRAP
setInterpolation
public void setInterpolation(int interpolation)
Set the type of interpolation to perform.
interpolation
- one of NEAREST_NEIGHBOUR or BILINEAR
transformInverse
protected abstract void transformInverse(int x,
int y,
float[] out)
Inverse transform a point. This method needs to be overriden by all subclasses.
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
transformSpace
protected void transformSpace(Rectangle rect)
Forward transform a rectangle. Used to determine the size of the output image.
rect
- the rectangle to transform