01: /*
02: * $RCSfile: TileRecycler.java,v $
03: *
04: * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
05: *
06: * Use is subject to license terms.
07: *
08: * $Revision: 1.1 $
09: * $Date: 2005/02/11 04:57:22 $
10: * $State: Exp $
11: */
12: package javax.media.jai;
13:
14: import java.awt.image.Raster;
15:
16: /**
17: * An interface to a mechanism which is capable of recycling tiles.
18: * In general the term <i>recycle</i> in this context is taken to
19: * mean re-using memory allocated to the tile. This would usually
20: * be accomplished by reclaiming the data bank (array) associated
21: * with the <code>DataBuffer</code> of the tile <code>Raster</code>.
22: * It would also be possible by simple translation of a
23: * <code>WritableRaster</code> provided the <code>SampleModel</code>
24: * was compatible with the tile required by its eventual user.
25: *
26: * <p><i>Tile recycling should be used with caution. In particular,
27: * the calling code must be certain that any tile submitted for
28: * recycling not be used elsewhere. If one or more references to
29: * tiles submitted to a recycler are held by the calling code then
30: * undefined and unexpected behavior may be observed. A similar
31: * caution applies to the tile's <code>DataBuffer</code> and the
32: * data bank array contained therein.</i></p>
33: *
34: * @since JAI 1.1.2
35: */
36: public interface TileRecycler {
37: /**
38: * Suggests to the <code>TileRecycler</code> that the parameter
39: * tile is no longer needed and may be used in creating a new
40: * <code>Raster</code>. This will inevitably result in at least
41: * the internal array being overwritten. If a reference to
42: * the tile, its <code>DataBuffer</code>, or the data bank(s) of its
43: * <code>DataBuffer</code> is held elsewhere in the caller's code,
44: * undefined behavior may result. <i>It is the responsibilty of
45: * the calling code to ensure that this does not occur.</i>
46: *
47: * @param tile A tile which mey be re-used either directly or
48: * by reclaiming its internal <code>DataBuffer</code>
49: * or primitive data array.
50: * @throws IllegalArgumentException if <code>tile</code> is
51: * <code>null</code>.
52: */
53: void recycleTile(Raster tile);
54: }
|