|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.Warp
A description of an image warp.
The central method of a Warp
is
warpSparseRect()
, which returns the source pixel positions
for a specified (subdivided) rectangular region of the output.
As in the Interpolation
class, pixel positions are
represented using scaled integer coordinates, yielding subpixel
accuracy but still allowing the use of integer arithmetic. The
degree of precision is set by means of the
getSubSampleBitsH()
and getSubSampleBitsV
parameters to the warpRect()
method.
Interpolation
,
WarpAffine
,
WarpGrid
,
WarpPerspective
,
WarpPolynomial
,
WarpQuadratic
,
WarpCubic
,
WarpGeneralPolynomial
,
WarpOpImage
, Serialized FormConstructor Summary | |
protected |
Warp()
Default constructor. |
Method Summary | |
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 sourceRect)
Computes a rectangle that is guaranteed to enclose the region of the destination that can potentially be affected by the pixels of a rectangle of a given source. |
float[] |
warpPoint(int x,
int y,
float[] destRect)
Computes the source subpixel position for a given destination pixel. |
int[] |
warpPoint(int x,
int y,
int subsampleBitsH,
int subsampleBitsV,
int[] destRect)
Computes the source subpixel position for a given destination pixel. |
float[] |
warpRect(int x,
int y,
int width,
int height,
float[] destRect)
Computes the source subpixel positions for a given rectangular destination region. |
int[] |
warpRect(int x,
int y,
int width,
int height,
int subsampleBitsH,
int subsampleBitsV,
int[] destRect)
Computes the source subpixel positions for a given rectangular destination region. |
abstract float[] |
warpSparseRect(int x,
int y,
int width,
int height,
int periodX,
int periodY,
float[] destRect)
This method is must be implemented in all concrete subclasses. |
int[] |
warpSparseRect(int x,
int y,
int width,
int height,
int periodX,
int periodY,
int subsampleBitsH,
int subsampleBitsV,
int[] 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 |
Constructor Detail |
protected Warp()
Method Detail |
public int[] warpRect(int x, int y, int width, int height, int subsampleBitsH, int subsampleBitsV, int[] destRect)
subsampleBitsH
and
subsampleBitsV
parameters.
The integral destination rectangle coordinates should be considered pixel indices. The continuous plane of pixels locates each pixel index at a half-pixel location. For example, destination pixel (0,0) is located at the real location (0.5, 0.5). Thus pixels are considered to have a dimension of (1.0 x 1.0) with their "energy" concentrated in a "delta function" at relative coordinates (0.5, 0.5).
Destination to source mappings must keep this (0.5, 0.5) pixel center in mind when formulating transformation functions. Given integral destination pixel indices as an input, the fractional source location, as calculated by functions X(xDst,yDst), Y(xDst,yDst) is given by:
Xsrc = X(xDst+0.5, yDst+0.5) - 0.5 Ysrc = Y(xDst+0.5, yDst+0.5) - 0.5
The subtraction of 0.5 in the above formula produces the source pixel indices (in fractional form) needed to implement the various types of interpolation algorithms.
All of the Sun-supplied warp mapping functions perform the above final subtraction, since they have no knowledge of what interpolation algorithm will be used by a WarpOpImage implementation.
As a convenience, an implementation is provided for this
method that calls warpSparseRect()
. Subclasses
may wish to provide their own implementations for better
performance.
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. Must be positive.height
- The height of the destination region. Must be positive.subsampleBitsH
- The desired fixed-point precision of the
output X coordinates. Must be positive.subsampleBitsV
- The desired fixed-point precision of the
output Y coordinates. Must be positive.destRect
- An int array containing at least
2*width*height
elements, or
null
. If null
, a new array
will be constructed.null
, or a new int
array
of length 2*width*height
otherwise.public float[] warpRect(int x, int y, int width, int height, float[] destRect)
As a convenience, an implementation is provided for this
method that calls warpSparseRect()
. Subclasses
may wish to provide their own implementations for better
performance.
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.destRect
- A float
array containing at least
2*width*height
elements, or
null
. If null
, a new array
will be constructed.destRect
parameter if
it is non-null
, or a new float
array of length 2*width*height
otherwise.public int[] warpPoint(int x, int y, int subsampleBitsH, int subsampleBitsV, int[] destRect)
subsampleBitsH
and
subsampleBitsV
parameters.
As a convenience, an implementation is provided for this
method that calls warpSparseRect()
. Subclasses
may wish to provide their own implementations for better
performance.
x
- The minimum X coordinate of the destination region.y
- The minimum Y coordinate of the destination region.subsampleBitsH
- The desired fixed-point precision of the
output X coordinates.subsampleBitsV
- The desired fixed-point precision of the
output Y coordinates.destRect
- An int
array containing at least 2
elements, or null
. If null
, a
new array will be constructed.null
, or a new int
array
of length 2 otherwise.public float[] warpPoint(int x, int y, float[] destRect)
As a convenience, an implementation is provided for this
method that calls warpSparseRect()
. Subclasses
may wish to provide their own implementations for better
performance.
x
- The minimum X coordinate of the destination region.y
- The minimum Y coordinate of the destination region.destRect
- A float
array containing at least
2 elements, or null
. If null
,
a new array will be constructed.destRect
parameter if
it is non-null
, or a new
float
array of length 2 otherwise.public int[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, int subsampleBitsH, int subsampleBitsV, int[] destRect)
subsampleBitsH
and subsampleBitsV
parameters.
As a convenience, an implementation is provided for this
method that calls warpSparseRect()
with a
float
destRect
parameter. Subclasses
may wish to provide their own implementations for better
performance.
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.subsampleBitsH
- The desired fixed-point precision of the
output X coordinates.subsampleBitsV
- The desired fixed-point precision of the
output Y coordinates.destRect
- An int 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 int
array otherwise.public abstract float[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, float[] destRect)
This method is must be implemented in all concrete subclasses.
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.destRect
parameter if
it is non-null
, or a new
float
array otherwise.public Rectangle mapSourceRect(Rectangle sourceRect)
WarpOpImage
method,
this routine may return null
if it is infeasible to compute such a bounding box.
The default implementation in this class returns null
.
sourceRect
- The Rectangle in source coordinates.Rectangle
in the destination coordinate
system that enclose the region that can potentially be
affected by the pixels of a rectangle of a given source,
or null
.public Rectangle mapDestRect(Rectangle destRect)
destRect
- 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
.destRect
is
null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |