|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--javax.media.jai.Warp
|
+--javax.media.jai.WarpPolynomial
|
+--javax.media.jai.WarpAffine
A description of an Affine warp.
The transform is specified as a mapping from destination space to source space, a backward mapping, as opposed to the forward mapping used in AffineOpImage.
The source position (x', y') of a point (x, y) is given by the first order (affine) bivariate polynomials:
x' = p(x, y) = c1 + c2*x + c3*y y' = q(x, y) = c4 + c5*x + c6*y
WarpAffine is marked final so that it may be more
easily inlined.
| Fields inherited from class javax.media.jai.WarpPolynomial |
degree, postScaleX, postScaleY, preScaleX, preScaleY, xCoeffs, yCoeffs |
| Constructor Summary | |
WarpAffine(AffineTransform transform)
Constructs a WarpAffine with pre- and post-scale
factors of 1. |
|
WarpAffine(AffineTransform transform,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
Constructs a WarpAffine with a given transform mapping
destination pixels into source space. |
|
WarpAffine(float[] xCoeffs,
float[] yCoeffs)
Constructs a WarpAffine with pre- and post-scale
factors of 1. |
|
WarpAffine(float[] xCoeffs,
float[] yCoeffs,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
Constructs a WarpAffine with a given transform mapping
destination pixels into source space. |
|
| Method Summary | |
AffineTransform |
getTransform()
Returns a clone of the AffineTransform associated
with this WarpAffine object. |
Point2D |
mapDestPoint(Point2D destPt)
Computes the source point corresponding to the supplied point. |
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. |
Point2D |
mapSourcePoint(Point2D sourcePt)
Computes the destination point corresponding to the supplied point. |
Rectangle |
mapSourceRect(Rectangle srcRect)
Computes a Rectangle that is guaranteed to enclose the region of the destination to which the source rectangle maps. |
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.WarpPolynomial |
createWarp, getCoeffs, getDegree, getPostScaleX, getPostScaleY, getPreScaleX, getPreScaleY, getXCoeffs, getYCoeffs |
| 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 |
public WarpAffine(float[] xCoeffs,
float[] yCoeffs,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
WarpAffine with a given transform mapping
destination pixels into source space. The transform is
given by:
x' = xCoeffs[0] + xCoeffs[1]*x + xCoeffs[2]*y; y' = yCoeffs[0] + yCoeffs[1]*x + yCoeffs[2]*y;where
x', y' are the source image coordinates
and x, y are the destination image coordinates.xCoeffs - The 3 destination to source transform coefficients for
the X coordinate.yCoeffs - The 3 destination to source transform coefficients for
the Y coordinate.preScaleX - The scale factor to apply to input (dest) X positions.preScaleY - The scale factor to apply to input (dest) Y positions.postScaleX - The scale factor to apply to the evaluated x transformpostScaleY - The scale factor to apply to the evaluated y transformIllegalArgumentException - if array xCoeffs or
yCoeffs does not have length of 3.
public WarpAffine(float[] xCoeffs,
float[] yCoeffs)
WarpAffine with pre- and post-scale
factors of 1.xCoeffs - The 3 destination to source transform coefficients for
the X coordinate.yCoeffs - The 3 destination to source transform coefficients for
the Y coordinate.
public WarpAffine(AffineTransform transform,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
WarpAffine 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.transform - The destination to source transform.preScaleX - The scale factor to apply to source X positions.preScaleY - The scale factor to apply to source Y positions.postScaleX - The scale factor to apply to destination X positions.postScaleY - The scale factor to apply to destination Y positions.public WarpAffine(AffineTransform transform)
WarpAffine with pre- and post-scale
factors of 1.transform - An AffineTransform mapping dest to source
coordinates.| Method Detail |
public AffineTransform getTransform()
AffineTransform associated
with this WarpAffine object.AffineTransform.
public float[] warpSparseRect(int x,
int y,
int width,
int height,
int periodX,
int periodY,
float[] destRect)
warpSparseRect in class Warpx - 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 vertical 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.destRect parameter if
it is non-null, or a new
float array otherwise.public Rectangle mapDestRect(Rectangle destRect)
mapDestRect in class WarpdestRect - The Rectangle in destination coordinates.Rectangle in the source coordinate
system that is guaranteed to contain all pixels
referenced by the output of warpRect() on
the destination region, or null.IllegalArgumentException - if destRect is
null.public Rectangle mapSourceRect(Rectangle srcRect)
mapSourceRect in class WarpsrcRect - The Rectangle in source coordinates.Rectangle in the destination coordinate
system that is guaranteed to contain all pixels
within the forward mapping of the source rectangle.IllegalArgumentException - if srctRect is
null.public Point2D mapDestPoint(Point2D destPt)
This method returns the value of pt in the following
code snippet:
double dx = (destPt.getX() + 0.5)*preScaleX;
double dy = (destPt.getY() + 0.5)*preScaleY;
Point2D pt = (Point2D)destPt.clone();
pt.setLocation((c1 + c2*dx + c3*dy)*postScaleX - 0.5F,
(c4 + c5*dx + c6*dy)*postScaleY - 0.5F);
mapDestPoint in class WarpPolynomialdestPt - the position in destination image coordinates
to map to source image coordinates.Point2D of the same class as
destPt.IllegalArgumentException - if destPt is
null.public Point2D mapSourcePoint(Point2D sourcePt)
If the transform is invertible, this method returns the value of
pt in the following code snippet:
double sx = (sourcePt.getX() + 0.5F)/postScaleX;
double sy = (sourcePt.getY() + 0.5F)/postScaleY;
Point2D pt = (Point2D)sourcePt.clone();
pt.setLocation((invc1 + invc2*sx + invc3*sy)/preScaleX - 0.5F,
(invc4 + invc5*sx + invc6*sy)/preScaleY - 0.5F);
where invc* are the inverse transform coefficients. If
the transform is not invertible, null is returned.mapSourcePoint in class WarpsourcePt - the position in source image coordinates
to map to destination image coordinates.Point2D of the same class as
sourcePt or null> if the transform is
not invertible.- Throws:
IllegalArgumentException - if destPt is
null.- Since:
- JAI 1.1.2
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||