Tuesday, 24 July 2007

Planar Image

The PlanarImage class is the main class for defining two-dimensional images. The PlanarImage implements the java.awt.image.RenderedImage interface, which describes a tiled, read-only image with a pixel layout described by a SampleModel and a DataBuffer. The TiledImage and OpImage subclasses manipulate the instance variables they inherit from PlanarImage, such as the image size, origin, tile dimensions, and tile grid offsets, as well as the Vectors containing the sources and sinks of the image.

All non-JAI RenderedImages that are to be used in JAI must be converted into PlanarImages by means of the RenderedImageAdapter class and the WriteableRenderedImageAdapter class. The wrapRenderedImage() method provides a convenient interface to both add a wrapper and take a snapshot if the image is writable. The standard PlanarImage constructor used by OpImages performs this wrapping automatically. Images that already extend PlanarImage will be returned unchanged by wrapRenderedImage().

* PlanarImage()
creates a PlanarImage.

* static PlanarImage wrapRenderedImage(RenderedImage im)
wraps an arbitrary RenderedImage to produce a PlanarImage.

* PlanarImage createSnapshot()
creates a snapshot, that is, a virtual copy of the image's current contents.

* Raster getData(Rectangle region)
returns a specified region of this image in a Raster.

* int getWidth()
returns the width of the image.

* int getHeight()
returns the height of the image.

* int getMinXCoord()
returns the X coordinate of the leftmost column of the image.

* int getMaxXCoord()
returns the X coordinate of the rightmost column of the image.

* int getMinYCoord()
returns the X coordinate of the uppermost row of the image.

* int getMaxYCoord()
returns the X coordinate of the bottom row of the image.

* Rectangle getBounds()
returns a Rectangle indicating the image bounds.

* int getTileWidth()
returns the width of a tile.

* int getTileHeight()
returns the height of a tile.

* int tilesAcross()
returns the number of tiles along the tile grid in the horizontal direction. Equivalent to getMaxTileX() - getMinTileX() + 1.

* int tilesDown()
returns the number of tiles along the tile grid in the vertical direction. Equivalent to getMaxTileY() - getMinTileY() + 1.

No comments: