javax.media.jai
Class WarpCubic
java.lang.Object
|
+--javax.media.jai.Warp
|
+--javax.media.jai.WarpPolynomial
|
+--javax.media.jai.WarpCubic
- All Implemented Interfaces:
- Serializable
- public final class WarpCubic
- extends WarpPolynomial
A cubic-based description of an image warp.
The source position (x', y') of a point (x, y) is given by the
cubic polynomial:
x' = p(x, y) = c1 + c2*x + c3*y + c4*x^2 + c5*x*y + c6*y^2 +
c7*x^3 + c8*x^2*y + c9*x*y^2 + c10*y^3
y' = q(x, y) = c11 + c12*x + c13*y + c14*x^2 + c15*x*y + c16*y^2 +
c17*x^3 + c18*x^2*y + c19*x*y^2 + c20*y^3
WarpCubic
is marked final so that it may be
more easily inlined.
- See Also:
WarpPolynomial
, Serialized Form
Constructor Summary |
WarpCubic(float[] xCoeffs,
float[] yCoeffs)
Constructs a WarpCubic with pre- and post-scale
factors of 1. |
WarpCubic(float[] xCoeffs,
float[] yCoeffs,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
Constructs a WarpCubic with a given transform mapping
destination pixels into source space. |
Method Summary |
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 java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
WarpCubic
public WarpCubic(float[] xCoeffs,
float[] yCoeffs,
float preScaleX,
float preScaleY,
float postScaleX,
float postScaleY)
- Constructs a
WarpCubic
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. The coeffs arrays must each contain 10 floats
corresponding to the coefficients c1, c2, etc. as shown in the
class comment.
- Parameters:
xCoeffs
- The 10 destination to source transform coefficients for
the X coordinate.yCoeffs
- The 10 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 result of the X polynomial evaluationpostScaleY
- The scale factor to apply to the result of the Y polynomial evaluation- Throws:
- IllegalArgumentException - if the length of the xCoeffs and yCoeffs arrays are not both 10.
WarpCubic
public WarpCubic(float[] xCoeffs,
float[] yCoeffs)
- Constructs a
WarpCubic
with pre- and post-scale
factors of 1.
- Parameters:
xCoeffs
- The 10 destination to source transform coefficients for
the X coordinate.yCoeffs
- The 10 destination to source transform coefficients for
the Y coordinate.- Throws:
- IllegalArgumentException - if the length of the xCoeffs and yCoeffs arrays are not both 10.
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 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.- Returns:
- A reference to the
destRect
parameter if
it is non-null
, or a new
float
array otherwise. - Throws:
- ArrayBoundsException - if destRect is too small