com.jhlabs.image
Class PerspectiveFilter

java.lang.Object
  extended by com.jhlabs.image.AbstractBufferedImageOp
      extended by com.jhlabs.image.TransformFilter
          extended by com.jhlabs.image.PerspectiveFilter
All Implemented Interfaces:
java.awt.image.BufferedImageOp, java.lang.Cloneable

public class PerspectiveFilter
extends TransformFilter

A filter which performs a perspective distortion on an image.


Field Summary
 
Fields inherited from class com.jhlabs.image.TransformFilter
BILINEAR, CLAMP, edgeAction, interpolation, NEAREST_NEIGHBOUR, originalSpace, transformedSpace, WRAP, ZERO
 
Constructor Summary
PerspectiveFilter()
          Construct a PerspectiveFilter.
PerspectiveFilter(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
          Construct a PerspectiveFilter.
 
Method Summary
 float getOriginX()
          Get the origin of the output image.
 float getOriginY()
          Get the origin of the output image.
 void setCorners(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
          Set the new positions of the image corners.
 java.lang.String toString()
           
protected  void transformInverse(int x, int y, float[] out)
          Inverse transform a point.
protected  void transformSpace(java.awt.Rectangle rect)
          Forward transform a rectangle.
 
Methods inherited from class com.jhlabs.image.TransformFilter
filter, filterPixelsNN, getEdgeAction, getInterpolation, setEdgeAction, setInterpolation
 
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

PerspectiveFilter

public PerspectiveFilter()
Construct a PerspectiveFilter.


PerspectiveFilter

public PerspectiveFilter(float x0,
                         float y0,
                         float x1,
                         float y1,
                         float x2,
                         float y2,
                         float x3,
                         float y3)
Construct a PerspectiveFilter.

Parameters:
x0 - the new position of the top left corner
y0 - the new position of the top left corner
x1 - the new position of the top right corner
y1 - the new position of the top right corner
x2 - the new position of the bottom right corner
y2 - the new position of the bottom right corner
x3 - the new position of the bottom left corner
y3 - the new position of the bottom left corner
Method Detail

setCorners

public void setCorners(float x0,
                       float y0,
                       float x1,
                       float y1,
                       float x2,
                       float y2,
                       float x3,
                       float y3)
Set the new positions of the image corners.

Parameters:
x0 - the new position of the top left corner
y0 - the new position of the top left corner
x1 - the new position of the top right corner
y1 - the new position of the top right corner
x2 - the new position of the bottom right corner
y2 - the new position of the bottom right corner
x3 - the new position of the bottom left corner
y3 - the new position of the bottom left corner

transformSpace

protected void transformSpace(java.awt.Rectangle rect)
Description copied from class: TransformFilter
Forward transform a rectangle. Used to determine the size of the output image.

Overrides:
transformSpace in class TransformFilter
Parameters:
rect - the rectangle to transform

getOriginX

public float getOriginX()
Get the origin of the output image. Use this for working out where to draw your new image.

Returns:
the X origin.

getOriginY

public float getOriginY()
Get the origin of the output image. Use this for working out where to draw your new image.

Returns:
the Y origin.

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