WritableRenderedImage
. TiledImage
is the main class for writable images in JAI. TiledImage
provides a straightforward implementation of the WritableRenderedImage
interface, taking advantage of that interface's ability to describe images with multiple tiles. The tiles of a WritableRenderedImage
must share a SampleModel
, which determines their width, height, and pixel format. The tiles form a regular grid, which may occupy any rectangular region of the plane. Tile pixels the locations of which lie outside the stated image bounds have undefined values.
The contents of a TiledImage
are defined by a single RenderedImage
source provided by means of one of the set()
methods or to a constructor which accepts a RenderedImage
. The set()
methods provide a way to selectively overwrite a portion of a TiledImage
, possibly using a region of interest (ROI).
TiledImage
also supports direct manipulation of pixels by means of the getWritableTile()
method. This method returns a WritableRaster
that can be modified directly. Such changes become visible to readers according to the regular thread synchronization rules of the Java virtual machine; JAI makes no additional guarantees. When a writer is finished modifying a tile, it should call releaseWritableTile()
. A shortcut is to call setData()
, which copies a rectangular region or an area specified by a ROI
from a supplied Raster
directly into the TiledImage
.
A final way to modify the contents of a TiledImage
is through calls to the object returned by createGraphics()
. This returns a Graphics2D
object that can be used to draw line art, text, and images in the usual Abstract Window Toolkit (AWT) manner.
A TiledImage
does not attempt to maintain synchronous state on its own. That task is left to SnapshotImage
. If a synchronous (unchangeable) view of a TiledImage
is desired, its createSnapshot()
method must be used. Otherwise, changes due to calls to set() or direct writing of tiles by objects that call getWritableTile()
will be visible.
TiledImage
does not actually cause its tiles to be copied from the specified source until their contents are demanded. Once a tile has been computed, its contents may be discarded if it can be determined that it can be recomputed identically from the source. The lockTile()
method forces a tile to be computed and maintained for the lifetime of the TiledImage
.
@see SnapshotImage
@see java.awt.image.RenderedImage
@see java.awt.image.WritableRenderedImage
|
|
|
|