01: /*
02: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any 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</code> 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</code> provides
36: * the necessary colors for <code>Graphics2D</code> operations in the
37: * form of a {@link Raster} associated with a {@link ColorModel}.
38: * The <code>PaintContext</code> 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: * @version 10 Feb 1997
43: */
44:
45: public interface PaintContext {
46: /**
47: * Releases the resources allocated for the operation.
48: */
49: public void dispose();
50:
51: /**
52: * Returns the <code>ColorModel</code> of the output. Note that
53: * this <code>ColorModel</code> might be different from the hint
54: * specified in the
55: * {@link Paint#createContext(ColorModel, Rectangle, Rectangle2D,
56: AffineTransform, RenderingHints) createContext} method of
57: * <code>Paint</code>. Not all <code>PaintContext</code> objects are
58: * capable of generating color patterns in an arbitrary
59: * <code>ColorModel</code>.
60: * @return the <code>ColorModel</code> of the output.
61: */
62: ColorModel getColorModel();
63:
64: /**
65: * Returns a <code>Raster</code> containing the colors generated for
66: * the graphics operation.
67: * @param x the x coordinate of the area in device space
68: * for which colors are generated.
69: * @param y the y coordinate of the area in device space
70: * for which colors are generated.
71: * @param w the width of the area in device space
72: * @param h the height of the area in device space
73: * @return a <code>Raster</code> representing the specified
74: * rectangular area and containing the colors generated for
75: * the graphics operation.
76: */
77: Raster getRaster(int x, int y, int w, int h);
78:
79: }
|