javax.media.jai
Class WarpPerspective

java.lang.Object
  |
  +--javax.media.jai.Warp
        |
        +--javax.media.jai.WarpPerspective
All Implemented Interfaces:
Serializable

public final class WarpPerspective
extends Warp

A description of a perspective (projective) warp.

The transform is specified as a mapping from srcination space to source space. This is a backward mapping, as opposed to the forward mapping used in AffineOpImage.

See Also:
Serialized Form

Constructor Summary
WarpPerspective(PerspectiveTransform transform)
          Constructs a WarpPerspective with a given transform mapping destination pixels into source space.
 
Method Summary
 PerspectiveTransform getTransform()
          Returns a clone of the PerspectiveTransform associated with this WarpPerspective object.
 Rectangle mapDestRect(Rectangle destRect)
          Computes a Rectangle that is guaranteed to enclose the region of the source that is required in order to produce a given rectangular output region.
 Rectangle mapSourceRect(Rectangle srcRect)
          Computes a Rectangle that is guaranteed to enclose the region of the source that is required in order to produce a given rectangular output region.
 float[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, float[] destRect)
          Computes the source subpixel positions for a given rectangular destination region, subsampled with an integral period.
 
Methods inherited from class javax.media.jai.Warp
warpPoint, warpPoint, warpRect, warpRect, warpSparseRect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarpPerspective

public WarpPerspective(PerspectiveTransform transform)
Constructs a WarpPerspective with a given transform mapping destination pixels into source space. Note that this is a backward mapping as opposed to the forward mapping used in AffineOpImage.
Parameters:
transform - The destination to source transform.
Throws:
IllegalArgumentException - if transform is null
Method Detail

getTransform

public PerspectiveTransform getTransform()
Returns a clone of the PerspectiveTransform associated with this WarpPerspective object.
Returns:
An instance of PerspectiveTransform.

warpSparseRect

public float[] warpSparseRect(int x,
                              int y,
                              int width,
                              int height,
                              int periodX,
                              int periodY,
                              float[] destRect)
Computes the source subpixel positions for a given rectangular destination region, subsampled with an integral period. The destination region is specified using normal integral (full pixel) coordinates. The source positions returned by the method are specified in floating point.
Overrides:
warpSparseRect in class Warp
Parameters:
x - The minimum X coordinate of the destination region.
y - The minimum Y coordinate of the destination region.
width - The width of the destination region.
height - The height of the destination region.
periodX - The horizontal sampling period.
periodY - The horizontal sampling period.
destRect - A float array containing at least 2*((width+periodX-1)/periodX)* ((height+periodY-1)/periodY) elements, or null. If null, a new array will be constructed.
Returns:
A reference to the destRect parameter if it is non-null, or a new float array otherwise.

mapDestRect

public Rectangle mapDestRect(Rectangle destRect)
Computes a Rectangle that is guaranteed to enclose the region of the source that is required in order to produce a given rectangular output region.
Overrides:
mapDestRect in class Warp
Parameters:
destRect - The Rectangle in destination coordinates.
Returns:
A Rectangle in the source coordinate system that is guaranteed to contain all pixels referenced by the output of warpRect() on the destination region.
Throws:
IllegalArgumentException - if destRect is null.

mapSourceRect

public Rectangle mapSourceRect(Rectangle srcRect)
Computes a Rectangle that is guaranteed to enclose the region of the source that is required in order to produce a given rectangular output region.
Overrides:
mapSourceRect in class Warp
Parameters:
srcRect - The Rectangle in source coordinates.
Returns:
A Rectangle in the destination coordinate system that is guaranteed to contain all pixels within the forward mapping of the source rectangle.
Throws:
IllegalArgumentException - is srcRect is null.
Since:
JAI 1.1