1 /* 2 * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.awt; 27 28 import java.awt.image.Raster; 29 import java.awt.image.ColorModel; 30 31 /** 32 * The {@code PaintContext} interface defines the encapsulated 33 * and optimized environment to generate color patterns in device 34 * space for fill or stroke operations on a 35 * {@link Graphics2D}. The {@code PaintContext} provides 36 * the necessary colors for {@code Graphics2D} operations in the 37 * form of a {@link Raster} associated with a {@link ColorModel}. 38 * The {@code PaintContext} maintains state for a particular paint 39 * operation. In a multi-threaded environment, several 40 * contexts can exist simultaneously for a single {@link Paint} object. 41 * @see Paint 42 */ 43 44 public interface PaintContext { 45 /** 46 * Releases the resources allocated for the operation. 47 */ 48 public void dispose(); 49 50 /** 51 * Returns the {@code ColorModel} of the output. Note that 52 * this {@code ColorModel} might be different from the hint 53 * specified in the 54 * {@link Paint#createContext(ColorModel, Rectangle, Rectangle2D, 55 AffineTransform, RenderingHints) createContext} method of 56 * {@code Paint}. Not all {@code PaintContext} objects are 57 * capable of generating color patterns in an arbitrary 58 * {@code ColorModel}. 59 * @return the {@code ColorModel} of the output. 60 */ 61 ColorModel getColorModel(); 62 63 /** 64 * Returns a {@code Raster} containing the colors generated for 65 * the graphics operation. 66 * @param x the x coordinate of the area in device space 67 * for which colors are generated. 68 * @param y the y coordinate of the area in device space 69 * for which colors are generated. 70 * @param w the width of the area in device space 71 * @param h the height of the area in device space 72 * @return a {@code Raster} representing the specified 73 * rectangular area and containing the colors generated for 74 * the graphics operation. 75 */ 76 Raster getRaster(int x, 77 int y, 78 int w, 79 int h); 80 81 } --- EOF ---