javax.media.jai
Interface TileComputationListener

All Superinterfaces:
EventListener

public interface TileComputationListener
extends EventListener

Interface to monitor tiles which have been submitted to the TileScheduler for non-prefetch background processing. The request parameter of each method corresponds to the value returned by the method used to queue the tiles, i.e., TileScheduler.scheduleTiles() or more commonly PlanarImage.queueTiles(). The eventSource parameter provides the identity of the emitter of the event. If the event is emitted by the TileScheduler itself this will be a reference to the TileScheduler object; if it is emitted by a RenderedOp this will be the RenderedOp node. The image parameter will in all cases be the image actually specified to the TileScheduler.

With respect to standard rendered imaging chains consisting of RenderedOp nodes, any TileComputationListeners registered with the RenderedOp itself will receive events from the RenderedOp so that the event source will be the RenderedOp. If the listener is registered with the rendering of the node, then the event source will likely be the TileScheduler itself. This is definitely the case if the rendering is either an OpImage or is a PlanarImage which has not overridden queueTiles().

The image parameter passed to any registered listener of a RenderedOp will contain a reference to the rendering of the node rather than to the node itself.

For a given TileComputationListener exactly one of the tile status callbacks should be invoked during the life cycle of a given tile in the TileScheduler.

Since:
JAI 1.1
See Also:
TileScheduler, TileRequest, RenderedOp, OpImage

Method Summary
 void tileCancelled(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY)
          To be invoked after a tile is cancelled.
 void tileComputationFailure(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Throwable situation)
          To be invoked when an exceptional situation prevents computation of a tile.
 void tileComputed(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Raster tile)
          To be invoked after each tile is computed.
 

Method Detail

tileComputed

public void tileComputed(Object eventSource,
                         TileRequest[] requests,
                         PlanarImage image,
                         int tileX,
                         int tileY,
                         Raster tile)
To be invoked after each tile is computed.

Parameters:
eventSource - The actual emitter of the tile scheduling event, i.e., the caller of this method.
requests - The relevant tile computation requests as returned by the method used to queue the tile.
image - The image for which tiles are being computed as specified to the TileScheduler.
tileX - The X index of the tile in the tile array.
tileY - The Y index of the tile in the tile array.
tile - The computed tile.

tileCancelled

public void tileCancelled(Object eventSource,
                          TileRequest[] requests,
                          PlanarImage image,
                          int tileX,
                          int tileY)
To be invoked after a tile is cancelled.

Parameters:
eventSource - The actual emitter of the tile scheduling event, i.e., the caller of this method.
requests - The relevant tile computation requests as returned by the method used to queue the tile.
image - The image for which tiles are being computed as specified to the TileScheduler.
tileX - The X index of the tile in the tile array.
tileY - The Y index of the tile in the tile array.

tileComputationFailure

public void tileComputationFailure(Object eventSource,
                                   TileRequest[] requests,
                                   PlanarImage image,
                                   int tileX,
                                   int tileY,
                                   Throwable situation)
To be invoked when an exceptional situation prevents computation of a tile.

Parameters:
eventSource - The actual emitter of the tile scheduling event, i.e., the caller of this method.
requests - The relevant tile computation requests as returned by the method used to queue the tile.
image - The image for which tiles are being computed as specified to the TileScheduler.
tileX - The X index of the tile in the tile array.
tileY - The Y index of the tile in the tile array.
situation - An object describing the error or exception which prevented computation of the tile.