|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A class implementing a caching mechanism for image tiles.
TileCache provides a central place for OpImages to
cache tiles they have computed. The tile cache is created with a
given tileCapacity measured in Rasters amd a given memoryCapacity
measured in bytes.
| Method Summary | |
void |
add(java.awt.image.RenderedImage owner,
int tileX,
int tileY,
java.awt.image.Raster data)
Adds a tile to the cache. |
void |
flush()
Advises the cache that all of its tiles may be discarded. |
long |
getMemoryCapacity()
Returns the memory capacity in bytes. |
java.awt.image.Raster |
getTile(java.awt.image.RenderedImage owner,
int tileX,
int tileY)
Retrieves a tile. |
int |
getTileCapacity()
Returns the tile capacity in tiles. |
void |
remove(java.awt.image.RenderedImage owner,
int tileX,
int tileY)
Advises the cache that a tile is no longer needed. |
void |
removeTiles(java.awt.image.RenderedImage owner)
Advises the cache that all tiles associated with a given image are no longer needed. |
void |
setMemoryCapacity(long memoryCapacity)
Sets the memory capacity to a desired number of bytes. |
void |
setTileCapacity(int tileCapacity)
Sets the tile capacity to a desired number of tiles. |
| Method Detail |
public void add(java.awt.image.RenderedImage owner,
int tileX,
int tileY,
java.awt.image.Raster data)
owner - The RenderedImage that the tile belongs to.tileX - The X index of the tile in the owner's tile grid.tileY - The Y index of the tile in the owner's tile grid.data - A Raster containing the tile data.
public void remove(java.awt.image.RenderedImage owner,
int tileX,
int tileY)
owner - The RenderedImage that the tile belongs to.tileX - The X index of the tile in the owner's tile grid.tileY - The Y index of the tile in the owner's tile grid.
public java.awt.image.Raster getTile(java.awt.image.RenderedImage owner,
int tileX,
int tileY)
null if the tile is not
present in the cache.owner - The RenderedImage that the tile belongs to.tileX - The X index of the tile in the owner's tile grid.tileY - The Y index of the tile in the owner's tile grid.public void removeTiles(java.awt.image.RenderedImage owner)
owner - The RenderedImage owner of the tiles
to be removed.public void flush()
public void setTileCapacity(int tileCapacity)
tileCapacity - The new capacity, in tiles.public int getTileCapacity()
public void setMemoryCapacity(long memoryCapacity)
memoryCapacity - The new capacity, in bytes.public long getMemoryCapacity()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||