KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > PaintContext


1 /*
2  * @(#)PaintContext.java 1.25 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt;
9
10 import java.awt.color.ColorSpace JavaDoc;
11 import java.awt.image.Raster JavaDoc;
12 import java.awt.image.ColorModel JavaDoc;
13
14 /**
15  * The <code>PaintContext</code> interface defines the encapsulated
16  * and optimized environment to generate color patterns in device
17  * space for fill or stroke operations on a
18  * {@link Graphics2D}. The <code>PaintContext</code> provides
19  * the necessary colors for <code>Graphics2D</code> operations in the
20  * form of a {@link Raster} associated with a {@link ColorModel}.
21  * The <code>PaintContext</code> maintains state for a particular paint
22  * operation. In a multi-threaded environment, several
23  * contexts can exist simultaneously for a single {@link Paint} object.
24  * @see Paint
25  * @version 10 Feb 1997
26  */

27
28 public interface PaintContext {
29     /**
30      * Releases the resources allocated for the operation.
31      */

32     public void dispose();
33
34     /**
35      * Returns the <code>ColorModel</code> of the output. Note that
36      * this <code>ColorModel</code> might be different from the hint
37      * specified in the
38      * {@link Paint#createContext(ColorModel, Rectangle, Rectangle2D,
39 AffineTransform, RenderingHints) createContext} method of
40      * <code>Paint</code>. Not all <code>PaintContext</code> objects are
41      * capable of generating color patterns in an arbitrary
42      * <code>ColorModel</code>.
43      * @return the <code>ColorModel</code> of the output.
44      */

45     ColorModel JavaDoc getColorModel();
46
47     /**
48      * Returns a <code>Raster</code> containing the colors generated for
49      * the graphics operation.
50      * @param x the x coordinate of the area in device space
51      * for which colors are generated.
52      * @param y the y coordinate of the area in device space
53      * for which colors are generated.
54      * @param w the width of the area in device space
55      * @param h the height of the area in device space
56      * @return a <code>Raster</code> representing the specified
57      * rectangular area and containing the colors generated for
58      * the graphics operation.
59      */

60     Raster JavaDoc getRaster(int x,
61              int y,
62              int w,
63              int h);
64
65 }
66
Popular Tags