|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.jai.PlanarImage | +--javax.media.jai.OpImage | +--javax.media.jai.AreaOpImage
An abstract base class for image operators that require only a fixed rectangular source region around a source pixel in order to compute each destination pixel.
The source and the destination images will occupy the same region of the plane. A given destination pixel (x, y) may be computed from the neighborhood of source pixels beginning at (x - leftPadding, y - topPadding) and extending to (x + rightPadding, y + bottomPadding) inclusive.
Since this operator needs a region around the source pixel in order to compute the destination pixel, the border destination pixels cannot be computed without any source extension. The source extension can be specified by supplying a BorderExtender that will define the pixel values of the source outside the actual source area.
If no extension is specified, the destination samples that cannot be computed will be written in the destination as zero. If the source image begins at pixel (minX, minY) and has width w and height h, the result of performing an area operation will be an image beginning at minX, minY, and having a width of w and a height of h, with the area being computed and written starting at (minX + leftPadding, minY + topPadding) and having width Math.max(w - leftPadding - rightPadding, 0) and height Math.max(h - topPadding - bottomPadding, 0).
A RenderingHints
for
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
with the value of
Boolean.TRUE
will automatically be added to the given
configuration
and passed up to the superclass constructor
so that area operations are performed on the pixel values instead
of being performed on the indices into the color map for those
operations whose source(s) have an IndexColorModel
.
This addition will only take place if a value for the
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
has not already been
provided by the user. Note that the configuration
Map
is cloned before the new hint is added to it. Regarding the value
for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL
RenderingHints
, the operator itself can be smart
based on the parameters, i.e. while the default value for
the JAI.KEY_REPLACE_INDEX_COLOR_MODEL
is
Boolean.TRUE
for operations that extend this class,
in some cases the operator could set the default.
BorderExtender
Field Summary | |
protected int |
bottomPadding
The number of source pixels needed below the central pixel. |
protected BorderExtender |
extender
The BorderExtender, may be null. |
protected int |
leftPadding
The number of source pixels needed to the left of the central pixel. |
protected int |
rightPadding
The number of source pixels needed to the right of the central pixel. |
protected int |
topPadding
The number of source pixels needed above the central pixel. |
Fields inherited from class javax.media.jai.OpImage |
cache, cobbleSources, OP_COMPUTE_BOUND, OP_IO_BOUND, OP_NETWORK_BOUND, tileCacheMetric, tileRecycler |
Fields inherited from class javax.media.jai.PlanarImage |
colorModel, eventManager, height, minX, minY, properties, sampleModel, tileFactory, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, width |
Constructor Summary | |
AreaOpImage(RenderedImage source,
ImageLayout layout,
Map configuration,
boolean cobbleSources,
BorderExtender extender,
int leftPadding,
int rightPadding,
int topPadding,
int bottomPadding)
Constructs an AreaOpImage . |
Method Summary | |
Raster |
computeTile(int tileX,
int tileY)
Computes a tile. |
BorderExtender |
getBorderExtender()
Retrieve the BorderExtender object associated with
this class instance. |
int |
getBottomPadding()
Returns the number of pixels needed below the central pixel. |
int |
getLeftPadding()
Returns the number of pixels needed to the left of the central pixel. |
int |
getRightPadding()
Returns the number of pixels needed to the right of the central pixel. |
int |
getTopPadding()
Returns the number of pixels needed above the central pixel. |
Rectangle |
mapDestRect(Rectangle destRect,
int sourceIndex)
Returns a conservative estimate of the region of a specified source that is required in order to compute the pixels of a given destination rectangle. |
Rectangle |
mapSourceRect(Rectangle sourceRect,
int sourceIndex)
Returns a conservative estimate of the destination region that can potentially be affected by the pixels of a rectangle of a given source. |
Methods inherited from class javax.media.jai.OpImage |
addTileToCache, cancelTiles, computeRect, computeRect, computesUniqueTiles, createTile, dispose, getExpandedNumBands, getFormatTags, getOperationComputeType, getTile, getTileCache, getTileCacheMetric, getTileDependencies, getTileFromCache, getTileRecycler, getTiles, hasExtender, mapDestPoint, mapSourcePoint, prefetchTiles, queueTiles, recycleTile, setTileCache, vectorize, vectorize, vectorize |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int leftPadding
protected int rightPadding
protected int topPadding
protected int bottomPadding
protected BorderExtender extender
Constructor Detail |
public AreaOpImage(RenderedImage source, ImageLayout layout, Map configuration, boolean cobbleSources, BorderExtender extender, int leftPadding, int rightPadding, int topPadding, int bottomPadding)
AreaOpImage
. The layout variables
are set in the standard way by the OpImage
constructor.
Additional control over the image bounds, tile grid layout,
SampleModel
, and ColorModel
may be
obtained by specifying an ImageLayout
parameter.
If the image bounds are specified but do not overlap the source
bounds then an IllegalArgumentException
will be thrown.
This parameter will be passed to the superclass constructor
unchanged.
A RenderingHints
for
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
with the value of
Boolean.TRUE
will automatically be added to the given
configuration
and passed up to the superclass constructor
so that area operations are performed on the pixel values instead
of being performed on the indices into the color map for those
operations whose source(s) have an IndexColorModel
.
This addition will only take place if a value for the
JAI.KEY_REPLACE_INDEX_COLOR_MODEL
has not already been
provided by the user. Note that the configuration
Map
is cloned before the new hint is added to it.
source
- A RenderedImage
.layout
- An ImageLayout
containing the source
dimensions before padding, and optionally containing the
tile grid layout, SampleModel
, and
ColorModel
.configuration
- Configurable attributes of the image including
configuration variables indexed by
RenderingHints.Key
s and image properties indexed
by String
s or CaselessStringKey
s.
This is simply forwarded to the superclass constructor.cobbleSources
- A boolean
indicating whether
computeRect()
expects contiguous sources.extender
- A BorderExtender, or null.leftPadding
- The desired left padding.rightPadding
- The desired right padding.topPadding
- The desired top padding.bottomPadding
- The desired bottom padding.IllegalArgumentException
- if source
is null
.IllegalArgumentException
- if the user-specified bounds do
intersect the source bounds.Method Detail |
public int getLeftPadding()
public int getRightPadding()
public int getTopPadding()
public int getBottomPadding()
public BorderExtender getBorderExtender()
BorderExtender
object associated with
this class instance. The object is returned by reference.BorderExtender
object
or null
.public Rectangle mapSourceRect(Rectangle sourceRect, int sourceIndex)
Rectangle
is not
clipped to the destination image bounds.mapSourceRect
in class OpImage
sourceRect
- the Rectangle
in source coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the potentially affected
destination region, or null
if the region is
unknown.IllegalArgumentException
- if sourceIndex
is
negative or greater than the index of the last source.IllegalArgumentException
- if sourceRect
is
null
.public Rectangle mapDestRect(Rectangle destRect, int sourceIndex)
Rectangle
is not clipped to the source image bounds.mapDestRect
in class OpImage
destRect
- the Rectangle
in destination coordinates.sourceIndex
- the index of the source image.Rectangle
indicating the required source region.IllegalArgumentException
- if sourceIndex
is
negative or greater than the index of the last source.IllegalArgumentException
- if destRect
is
null
.public Raster computeTile(int tileX, int tileY)
computeRect(Raster[], WritableRaster, Rectangle)
is called for each of the resulting regions. Otherwise,
computeRect(PlanarImage[], WritableRaster,
Rectangle)
is called once to compute the entire active
area of the tile.
The image bounds may be larger than the bounds of the source image. In this case, samples for which there are no no corresponding sources are set to zero.
computeTile
in class OpImage
tileX
- The X index of the tile.tileY
- The Y index of the tile.Raster
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |