2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. 290N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 290N/A * This code is free software; you can redistribute it and/or modify it 290N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 290N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 290N/A * This code is distributed in the hope that it will be useful, but WITHOUT 290N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 290N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 290N/A * version 2 for more details (a copy is included in the LICENSE file that 290N/A * accompanied this code). 290N/A * You should have received a copy of the GNU General Public License version 290N/A * 2 along with this work; if not, write to the Free Software Foundation, 290N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 290N/A/* **************************************************************** 290N/A ****************************************************************** 290N/A ****************************************************************** 290N/A *** COPYRIGHT (c) Eastman Kodak Company, 1997 290N/A *** As an unpublished work pursuant to Title 17 of the United 290N/A *** States Code. All rights reserved. 290N/A ****************************************************************** 290N/A ****************************************************************** 290N/A ******************************************************************/ 290N/A * WriteableRenderedImage is a common interface for objects which 290N/A * contain or can produce image data in the form of Rasters and 290N/A * which can be modified and/or written over. The image 290N/A * WritableRenderedImage provides notification to other interested 290N/A * objects when a tile is checked out for writing (via the 290N/A * getWritableTile method) and when the last writer of a particular 290N/A * tile relinquishes its access (via a call to releaseWritableTile). 290N/A * Additionally, it allows any caller to determine whether any tiles 290N/A * are currently checked out (via hasTileWriters), and to obtain a 290N/A * list of such tiles (via getWritableTileIndices, in the form of a Vector 290N/A * Objects wishing to be notified of changes in tile writability must 290N/A * implement the TileObserver interface, and are added by a 290N/A * call to addTileObserver. Multiple calls to 290N/A * addTileObserver for the same object will result in multiple 290N/A * notifications. An existing observer may reduce its notifications 290N/A * by calling removeTileObserver; if the observer had no 290N/A * notifications the operation is a no-op. 290N/A * It is necessary for a WritableRenderedImage to ensure that 290N/A * notifications occur only when the first writer acquires a tile and 290N/A * the last writer releases it. 290N/A * Adds an observer. If the observer is already present, 290N/A * it will receive multiple notifications. 290N/A * @param to the specified <code>TileObserver</code> 290N/A * Removes an observer. If the observer was not registered, 290N/A * nothing happens. If the observer was registered for multiple 290N/A * notifications, it will now be registered for one fewer. 290N/A * @param to the specified <code>TileObserver</code> 290N/A * Checks out a tile for writing. 290N/A * The WritableRenderedImage is responsible for notifying all 290N/A * of its TileObservers when a tile goes from having 290N/A * no writers to having one writer. 290N/A * @param tileX the X index of the tile. 290N/A * @param tileY the Y index of the tile. 290N/A * @return a writable tile. 290N/A * Relinquishes the right to write to a tile. If the caller 290N/A * continues to write to the tile, the results are undefined. 290N/A * Calls to this method should only appear in matching pairs 290N/A * with calls to getWritableTile; any other use will lead 290N/A * to undefined results. 290N/A * The WritableRenderedImage is responsible for notifying all of 290N/A * its TileObservers when a tile goes from having one writer 290N/A * to having no writers. 290N/A * @param tileX the X index of the tile. 290N/A * @param tileY the Y index of the tile. 290N/A * Returns whether a tile is currently checked out for writing. 290N/A * @param tileX the X index of the tile. 290N/A * @param tileY the Y index of the tile. 290N/A * @return <code>true</code> if specified tile is checked out 290N/A * for writing; <code>false</code> otherwise. 290N/A * Returns an array of Point objects indicating which tiles 290N/A * are checked out for writing. Returns null if none are 290N/A * @return an array containing the locations of tiles that are 290N/A * checked out for writing. 290N/A * Returns whether any tile is checked out for writing. 290N/A * Semantically equivalent to (getWritableTileIndices() != null). 290N/A * @return <code>true</code> if any tiles are checked out for 290N/A * writing; <code>false</code> otherwise. 290N/A * Sets a rect of the image to the contents of the Raster r, which is 290N/A * assumed to be in the same coordinate space as the WritableRenderedImage. 290N/A * The operation is clipped to the bounds of the WritableRenderedImage. 290N/A * @param r the specified <code>Raster</code>