A tile represents all of the storage for its spatial region of the image. If an image contains three bands, every tile represents all three bands of storage. The use of tiled images improves application performance by allowing the application to process an image region within a single tile without bringing the entire image into memory.
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 contents of a TiledImage are defined by a single PlanarImage source, provided either at construction time or by means of the set() method.
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 the releaseWritableTile method. A shortcut is to call the setData() method, which copies a rectangular region from a supplied Raster directly into the TiledImage.
A final way to modify the contents of a TiledImage is through calls to the createGraphics() method. This method returns a GraphicsJAI object that can be used to draw line art, text, and images in the usual AWT manner.
TiledImage does not actually cause its tiles to be computed 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.
* TiledImage(Point origin, SampleModel sampleModel, int tileWidth, int tileHeight)
constructs a TiledImage with a SampleModel that is compatible with a given SampleModel, and given tile dimensions. The width and height are taken from the SampleModel, and the image begins at a specified point.
* TiledImage(SampleModel sampleModel, int tileWidth, int tileHeight)
constructs a TiledImage starting at the global coordinate origin.
* TiledImage(int minX, int minY, int width, int height, int tileGridXOffset, int tileGridYOffset, SampleModel sampleModel, ColorModel colorModel)
constructs a TiledImage of a specified width and height.
* void setData(Raster r)
sets a region of a TiledImage to be a copy of a supplied Raster. The Raster's coordinate system is used to position it within the image.
* void setData(Raster r, ROI roi)
sets a region of a TiledImage to be a copy of a supplied Raster. The Raster's coordinate system is used to position it within the image.
* WritableRaster getWritableTile(int tileX, int tileY)
retrieves a particular tile from the image for reading and writing.
* Raster getTile(int tileX, int tileY)
retrieves a particular tile from the image for reading only.
* boolean isTileWritable(int tileX, int tileY)
returns true if a tile has writers.
* boolean hasTileWriters()
returns true if any tile is being held by a writer, false otherwise.
* void releaseWritableTile(int tileX, int tileY)
indicates that a writer is done updating a tile.
* void set(RenderedImage im)
overlays a given RenderedImage on top of the current contents of the TiledImage.
* void set(RenderedImage im, ROI roi)
overlays a given RenderedImage on top of the current contents of the TiledImage.
* Graphics2D createGraphics()
creates a Graphics2D object that can be used to paint text and graphics onto the TiledImage.
The TileCache interface provides a central place for OpImages to cache tiles they have computed. The tile cache is created with a given capacity (measured in tiles). By default, the tile capacity for a new tile cache is 300 tiles. The default memory capacity reserved for tile cache is 20M bytes.
* static TileCache createTileCache(int tileCapacity, long memCapacity)
constructs a TileCache with the given tile capacity in tiles and memory capacity in bytes.
* static TileCache createTileCache()
constructs a TileCache with the default tile capacity in tiles and memory capacity in bytes.
* void setTileCache(TileCache tileCache)
sets the TileCache to be used by this JAI instance. The tileCache parameter will be added to the RenderingHints of this JAI instance.
* TileCache getTileCache()
returns the TileCache being used by this JAI instance.
A pattern tile consists of a repeated pattern. The pattern operation defines a pattern tile by specifying the width and height; all other layout parameters are optional, and when not specified are set to default values. Each tile of the destination image will be defined by a reference to a shared instance of the pattern.
Tuesday, 24 July 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment