javax.media.jai
Interface TileFactory

All Known Implementing Classes:
RecyclingTileFactory

public interface TileFactory

An interface defining a mechanism which may be used to create tiles for an image. Implementations of this interface might be based for example on managing a pool of memory, recycling previously allocated memory, or using an image as a backing store.

Since:
JAI 1.1.2

Method Summary
 boolean canReclaimMemory()
          Returns a value indicating whether a tile returned by createTile() might be created without allocating new memory for the requisite data array.
 WritableRaster createTile(SampleModel sampleModel, Point location)
          Create a tile with the specified SampleModel and location, possibly using a DataBuffer constructed using a reclaimed data bank (array).
 void flush()
          Removes references to all internally cached data arrays, if any.
 long getMemoryUsed()
          Returns the amount of memory currently being consumed by data arrays cached within this object.
 boolean isMemoryCache()
          Returns true if this object can cache in main memory any data arrays which might be made available for future use.
 

Method Detail

canReclaimMemory

public boolean canReclaimMemory()
Returns a value indicating whether a tile returned by createTile() might be created without allocating new memory for the requisite data array.


isMemoryCache

public boolean isMemoryCache()
Returns true if this object can cache in main memory any data arrays which might be made available for future use.


getMemoryUsed

public long getMemoryUsed()
Returns the amount of memory currently being consumed by data arrays cached within this object. If this object does not cache data arrays then this method will always return zero.

Returns:
The amount of memory used by internally cached data arrays, measured in bytes.

flush

public void flush()
Removes references to all internally cached data arrays, if any. If such arrays are objects potentially subject to finalization, then this should make them available for garbage collection provided no references to them are held elsewhere.


createTile

public WritableRaster createTile(SampleModel sampleModel,
                                 Point location)
Create a tile with the specified SampleModel and location, possibly using a DataBuffer constructed using a reclaimed data bank (array). If it is not possible to reclaim an array, a new one will be allocated so that a tile is guaranteed to be generated. If a reclaimed array is used to create the tile, its elements should be set to zero before the tile is returned to the caller.

Parameters:
sampleModel - The SampleModel to use in creating the WritableRaster.
location - The location (minX, minY) of the WritableRaster; if null, (0, 0) will be used.
Returns:
A WritableRaster which might have a DataBuffer created using a previously allocated array.
Throws:
IllegalArgumentionException - if sampleModel is null.