< prev index next >

src/java.desktop/share/classes/java/awt/image/WritableRenderedImage.java

Print this page




  55  * Objects wishing to be notified of changes in tile writability must
  56  * implement the TileObserver interface, and are added by a
  57  * call to addTileObserver.  Multiple calls to
  58  * addTileObserver for the same object will result in multiple
  59  * notifications.  An existing observer may reduce its notifications
  60  * by calling removeTileObserver; if the observer had no
  61  * notifications the operation is a no-op.
  62  * <p>
  63  * It is necessary for a WritableRenderedImage to ensure that
  64  * notifications occur only when the first writer acquires a tile and
  65  * the last writer releases it.
  66  *
  67  */
  68 
  69 public interface WritableRenderedImage extends RenderedImage
  70 {
  71 
  72   /**
  73    * Adds an observer.  If the observer is already present,
  74    * it will receive multiple notifications.
  75    * @param to the specified <code>TileObserver</code>
  76    */
  77   public void addTileObserver(TileObserver to);
  78 
  79   /**
  80    * Removes an observer.  If the observer was not registered,
  81    * nothing happens.  If the observer was registered for multiple
  82    * notifications, it will now be registered for one fewer.
  83    * @param to the specified <code>TileObserver</code>
  84    */
  85   public void removeTileObserver(TileObserver to);
  86 
  87   /**
  88    * Checks out a tile for writing.
  89    *
  90    * The WritableRenderedImage is responsible for notifying all
  91    * of its TileObservers when a tile goes from having
  92    * no writers to having one writer.
  93    *
  94    * @param tileX the X index of the tile.
  95    * @param tileY the Y index of the tile.
  96    * @return a writable tile.
  97    */
  98   public WritableRaster getWritableTile(int tileX, int tileY);
  99 
 100   /**
 101    * Relinquishes the right to write to a tile.  If the caller
 102    * continues to write to the tile, the results are undefined.
 103    * Calls to this method should only appear in matching pairs
 104    * with calls to getWritableTile; any other use will lead
 105    * to undefined results.
 106    *
 107    * The WritableRenderedImage is responsible for notifying all of
 108    * its TileObservers when a tile goes from having one writer
 109    * to having no writers.
 110    *
 111    * @param tileX the X index of the tile.
 112    * @param tileY the Y index of the tile.
 113    */
 114   public void releaseWritableTile(int tileX, int tileY);
 115 
 116   /**
 117    * Returns whether a tile is currently checked out for writing.
 118    *
 119    * @param tileX the X index of the tile.
 120    * @param tileY the Y index of the tile.
 121    * @return <code>true</code> if specified tile is checked out
 122    *         for writing; <code>false</code> otherwise.
 123    */
 124   public boolean isTileWritable(int tileX, int tileY);
 125 
 126   /**
 127    * Returns an array of Point objects indicating which tiles
 128    * are checked out for writing.  Returns null if none are
 129    * checked out.
 130    * @return an array containing the locations of tiles that are
 131    *         checked out for writing.
 132    */
 133   public Point[] getWritableTileIndices();
 134 
 135   /**
 136    * Returns whether any tile is checked out for writing.
 137    * Semantically equivalent to (getWritableTileIndices() != null).
 138    * @return <code>true</code> if any tiles are checked out for
 139    *         writing; <code>false</code> otherwise.
 140    */
 141   public boolean hasTileWriters();
 142 
 143   /**
 144    * Sets a rect of the image to the contents of the Raster r, which is
 145    * assumed to be in the same coordinate space as the WritableRenderedImage.
 146    * The operation is clipped to the bounds of the WritableRenderedImage.
 147    * @param r the specified <code>Raster</code>
 148    */
 149   public void setData(Raster r);
 150 
 151 }


  55  * Objects wishing to be notified of changes in tile writability must
  56  * implement the TileObserver interface, and are added by a
  57  * call to addTileObserver.  Multiple calls to
  58  * addTileObserver for the same object will result in multiple
  59  * notifications.  An existing observer may reduce its notifications
  60  * by calling removeTileObserver; if the observer had no
  61  * notifications the operation is a no-op.
  62  * <p>
  63  * It is necessary for a WritableRenderedImage to ensure that
  64  * notifications occur only when the first writer acquires a tile and
  65  * the last writer releases it.
  66  *
  67  */
  68 
  69 public interface WritableRenderedImage extends RenderedImage
  70 {
  71 
  72   /**
  73    * Adds an observer.  If the observer is already present,
  74    * it will receive multiple notifications.
  75    * @param to the specified {@code TileObserver}
  76    */
  77   public void addTileObserver(TileObserver to);
  78 
  79   /**
  80    * Removes an observer.  If the observer was not registered,
  81    * nothing happens.  If the observer was registered for multiple
  82    * notifications, it will now be registered for one fewer.
  83    * @param to the specified {@code TileObserver}
  84    */
  85   public void removeTileObserver(TileObserver to);
  86 
  87   /**
  88    * Checks out a tile for writing.
  89    *
  90    * The WritableRenderedImage is responsible for notifying all
  91    * of its TileObservers when a tile goes from having
  92    * no writers to having one writer.
  93    *
  94    * @param tileX the X index of the tile.
  95    * @param tileY the Y index of the tile.
  96    * @return a writable tile.
  97    */
  98   public WritableRaster getWritableTile(int tileX, int tileY);
  99 
 100   /**
 101    * Relinquishes the right to write to a tile.  If the caller
 102    * continues to write to the tile, the results are undefined.
 103    * Calls to this method should only appear in matching pairs
 104    * with calls to getWritableTile; any other use will lead
 105    * to undefined results.
 106    *
 107    * The WritableRenderedImage is responsible for notifying all of
 108    * its TileObservers when a tile goes from having one writer
 109    * to having no writers.
 110    *
 111    * @param tileX the X index of the tile.
 112    * @param tileY the Y index of the tile.
 113    */
 114   public void releaseWritableTile(int tileX, int tileY);
 115 
 116   /**
 117    * Returns whether a tile is currently checked out for writing.
 118    *
 119    * @param tileX the X index of the tile.
 120    * @param tileY the Y index of the tile.
 121    * @return {@code true} if specified tile is checked out
 122    *         for writing; {@code false} otherwise.
 123    */
 124   public boolean isTileWritable(int tileX, int tileY);
 125 
 126   /**
 127    * Returns an array of Point objects indicating which tiles
 128    * are checked out for writing.  Returns null if none are
 129    * checked out.
 130    * @return an array containing the locations of tiles that are
 131    *         checked out for writing.
 132    */
 133   public Point[] getWritableTileIndices();
 134 
 135   /**
 136    * Returns whether any tile is checked out for writing.
 137    * Semantically equivalent to (getWritableTileIndices() != null).
 138    * @return {@code true} if any tiles are checked out for
 139    *         writing; {@code false} otherwise.
 140    */
 141   public boolean hasTileWriters();
 142 
 143   /**
 144    * Sets a rect of the image to the contents of the Raster r, which is
 145    * assumed to be in the same coordinate space as the WritableRenderedImage.
 146    * The operation is clipped to the bounds of the WritableRenderedImage.
 147    * @param r the specified {@code Raster}
 148    */
 149   public void setData(Raster r);
 150 
 151 }
< prev index next >