|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.BorderExtender
An abstract superclass for classes that extend or "pad" a
WritableRaster
with additional pixel data taken from a
PlanarImage
. Instances of BorderExtender
are used by the getExtendedData()
and
copyExtendedData()
methods in
PlanarImage
.
Each instance of BorderExtender
has an
extend()
method that takes a
WritableRaster
and a PlanarImage
. The
portion of the raster that intersects the bounds of the image will
already contain a copy of the image data. The remaining area is to
be filled in according to the policy of the
BorderExtender
subclass.
The standard subclasses of BorderExtender
are
BorderExtenderZero
, which fills pixels with zeros;
BorderExtenderConstant
, which fills pixels with a
given constant value; BorderExtenderCopy
, which copies
the edge pixels of the image; BorderExtenderWrap
,
which tiles the plane with repeating copies of the image; and
BorderExtenderReflect
, which is like
BorderExtenderWrap
except that each copy of the image
is suitably reflected.
Instances of BorderExtenderConstant
are
constructed in the usual way. Instances of the other standard subclasses
are obtained by means of the createInstance()
method
of this class.
BorderExtenderCopy
is particularly useful as a way
of padding image data prior to performing area or geometric
operations such as convolution, scaling, and rotation.
PlanarImage.getExtendedData(java.awt.Rectangle, javax.media.jai.BorderExtender)
,
PlanarImage.copyExtendedData(java.awt.image.WritableRaster, javax.media.jai.BorderExtender)
,
BorderExtenderConstant
,
BorderExtenderCopy
,
BorderExtenderReflect
,
BorderExtenderWrap
,
BorderExtenderZero
, Serialized FormField Summary | |
static int |
BORDER_COPY
A constant for use in the createInstance method. |
static int |
BORDER_REFLECT
A constant for use in the createInstance method. |
static int |
BORDER_WRAP
A constant for use in the createInstance method. |
static int |
BORDER_ZERO
A constant for use in the createInstance method. |
Constructor Summary | |
BorderExtender()
|
Method Summary | |
static BorderExtender |
createInstance(int extenderType)
Returns an instance of BorderExtender that
implements a given extension policy. |
abstract void |
extend(WritableRaster raster,
PlanarImage im)
Fills in the portions of a given WritableRaster that
lie outside the bounds of a given PlanarImage . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BORDER_ZERO
createInstance
method.public static final int BORDER_COPY
createInstance
method.public static final int BORDER_REFLECT
createInstance
method.public static final int BORDER_WRAP
createInstance
method.Constructor Detail |
public BorderExtender()
Method Detail |
public abstract void extend(WritableRaster raster, PlanarImage im)
WritableRaster
that
lie outside the bounds of a given PlanarImage
.
Depending on the policy of the BorderExtender
, data
might or might not be derived from the PlanarImage
.
The portion of raster
that lies within
im.getBounds()
must not be altered. The pixels
within this region should not be assumed to have any particular
values.
Each subclass may implement a different policy regarding how the extension data is computed.
raster
- The WritableRaster
the border area of
which is to be filled according to the policy of the
BorderExtender
.im
- The PlanarImage
which may provide the
data with which to fill the border area of the
WritableRaster
.IllegalArgumentException
- if either parameter is
null
.public static BorderExtender createInstance(int extenderType)
BorderExtender
that
implements a given extension policy. The policies understood
by this method are:
BORDER_ZERO
: set sample values to zero.
BORDER_COPY
: set sample values to copies of
the nearest valid pixel. For example, pixels to the left of
the valid rectangle will take on the value of the valid edge
pixel in the same row. Pixels both above and to the left of
the valid rectangle will take on the value of the upper-left
pixel.
BORDER_REFLECT
: the output image is defined
as if mirrors were placed along the edges of the source image.
Thus if the left edge of the valid rectangle lies at X = 10,
pixel (9, Y) will be a copy of pixel (10, Y); pixel (6, Y)
will be a copy of pixel (13, Y).
BORDER_WRAP
: the source image is tiled repeatedly
in the plane.
Note that this method may not be used to create an instance
of BorderExtenderConstant
.
Any other input value will cause an
IllegalArgumentException
to be thrown.
extenderType
- The type of BorderExtender
to create.
Must be one of the predefined class constants
BORDER_COPY
,
BORDER_REFLECT
,
BORDER_WRAP
, or
BORDER_ZERO
.IllegalArgumentException
- if the supplied
parameter is not one of the supported predefined constants.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |