javax.media.jai
Interface TileCache


public abstract interface TileCache

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

add

public void add(java.awt.image.RenderedImage owner,
                int tileX,
                int tileY,
                java.awt.image.Raster data)
Adds a tile to the cache.
Parameters:
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.

remove

public void remove(java.awt.image.RenderedImage owner,
                   int tileX,
                   int tileY)
Advises the cache that a tile is no longer needed. It is legal to implement this method as a no-op.
Parameters:
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.

getTile

public java.awt.image.Raster getTile(java.awt.image.RenderedImage owner,
                                     int tileX,
                                     int tileY)
Retrieves a tile. Returns null if the tile is not present in the cache.
Parameters:
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.

removeTiles

public void removeTiles(java.awt.image.RenderedImage owner)
Advises the cache that all tiles associated with a given image are no longer needed. It is legal to implement this method as a no-op.
Parameters:
owner - The RenderedImage owner of the tiles to be removed.

flush

public void flush()
Advises the cache that all of its tiles may be discarded. It is legal to implement this method as a no-op.

setTileCapacity

public void setTileCapacity(int tileCapacity)
Sets the tile capacity to a desired number of tiles. If the capacity is smaller than the current capacity, tiles are flushed from the cache.
Parameters:
tileCapacity - The new capacity, in tiles.

getTileCapacity

public int getTileCapacity()
Returns the tile capacity in tiles.

setMemoryCapacity

public void setMemoryCapacity(long memoryCapacity)
Sets the memory capacity to a desired number of bytes. If the memory capacity is smaller than the amount of memory currently used by the cache, tiles are flushed until the TileCache's memory usage is less than memoryCapacity.
Parameters:
memoryCapacity - The new capacity, in bytes.

getMemoryCapacity

public long getMemoryCapacity()
Returns the memory capacity in bytes.



Casa de Bender