001: /*
002: * $RCSfile: TileRequest.java,v $
003: *
004: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005: *
006: * Use is subject to license terms.
007: *
008: * $Revision: 1.1 $
009: * $Date: 2005/02/11 04:57:22 $
010: * $State: Exp $
011: */
012: package javax.media.jai;
013:
014: import java.awt.Point;
015:
016: /**
017: * Interface representing a <code>TileScheduler</code> request to compute
018: * a specific set of tiles for a given image with optional monitoring by
019: * <code>TileComputationListener</code>s.
020: *
021: * @see TileScheduler
022: * @see TileComputationListener
023: * @see RenderedOp
024: * @see OpImage
025: *
026: * @since JAI 1.1
027: */
028: public interface TileRequest {
029:
030: /**
031: * Status value indicating that the tile has yet to be processed.
032: */
033: public static final int TILE_STATUS_PENDING = 0;
034:
035: /**
036: * Status value indicating that the tile has is being processed.
037: */
038: public static final int TILE_STATUS_PROCESSING = 1;
039:
040: /**
041: * Status value indicating that the tile has been computed successfully.
042: */
043: public static final int TILE_STATUS_COMPUTED = 2;
044:
045: /**
046: * Status value indicating that the tile computation has been cancelled.
047: */
048: public static final int TILE_STATUS_CANCELLED = 3;
049:
050: /**
051: * Status value indicating that the tile computation failed.
052: */
053: public static final int TILE_STATUS_FAILED = 4;
054:
055: /**
056: * Returns the image associated with the request. This is the image
057: * which is actually specified to the <code>TileScheduler</code>. For
058: * most <code>PlanarImage</code>s (including <code>OpImage</code>s)
059: * this will be the image on which <code>queueTiles()</code> was
060: * invoked; for <code>RenderedOp</code> nodes this will be the rendering
061: * of the node.
062: */
063: PlanarImage getImage();
064:
065: /**
066: * Returns the tile indices of all tiles associated with the request.
067: */
068: Point[] getTileIndices();
069:
070: /**
071: * Returns the array of <code>TileComputationListener</code>s specified as
072: * monitoring the request. The returned value should be <code>null</code>
073: * if there are no such listeners.
074: */
075: TileComputationListener[] getTileListeners();
076:
077: /**
078: * Whether this <code>TileRequest</code> implementation supports the
079: * <code>getTileStatus()</code> method.
080: */
081: boolean isStatusAvailable();
082:
083: /**
084: * Returns one of the <code>TILE_STATUS_*</code> constants defined in
085: * this interface to indicate the status of the specified tile (optional
086: * operation). Implementations for which status is available, i.e.,
087: * for which <code>isStatusAvailable()</code> returns <code>true</code>,
088: * may but are not required to support all status levels defined by
089: * this interface. The status levels must however be a subset of those
090: * herein defined.
091: *
092: * @param tileX The X index of the tile in the tile array.
093: * @param tileY The Y index of the tile in the tile array.
094: *
095: * @exception UnsupportedOperationException if
096: * <code>isStatusAvailable()</code> returns <code>false</code>.
097: * @exception IllegalArgumentException if the specified tile is not
098: * associated with this request.
099: */
100: int getTileStatus(int tileX, int tileY);
101:
102: /**
103: * Issues a request to the <code>TileScheduler</code> which generated
104: * this <code>TileRequest</code> to cancel all tiles in the supplied
105: * parameter array which are associated with this request. Any tiles
106: * in the array which are not associated with this request will be
107: * ignored. If the parameter is <code>null</code> a request to cancel
108: * all tiles in the request will be issued. This method should merely
109: * be a convenience wrapper around the <code>cancelTiles()</code>
110: * method of the <code>TileScheduler</code> which created the
111: * <code>TileRequest</code>.
112: */
113: void cancelTiles(Point[] tileIndices);
114: }
|