author | henryjen |
Tue, 10 Jun 2014 16:18:54 -0700 | |
changeset 24865 | 09b1d992ca72 |
parent 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package java.awt; |
|
27 |
||
28 |
import java.awt.image.ColorModel; |
|
29 |
import java.awt.geom.AffineTransform; |
|
30 |
import java.awt.geom.Rectangle2D; |
|
31 |
||
32 |
/** |
|
33 |
* This <code>Paint</code> interface defines how color patterns |
|
34 |
* can be generated for {@link Graphics2D} operations. A class |
|
35 |
* implementing the <code>Paint</code> interface is added to the |
|
36 |
* <code>Graphics2D</code> context in order to define the color |
|
37 |
* pattern used by the <code>draw</code> and <code>fill</code> methods. |
|
38 |
* <p> |
|
39 |
* Instances of classes implementing <code>Paint</code> must be |
|
40 |
* read-only because the <code>Graphics2D</code> does not clone |
|
41 |
* these objects when they are set as an attribute with the |
|
42 |
* <code>setPaint</code> method or when the <code>Graphics2D</code> |
|
43 |
* object is itself cloned. |
|
44 |
* @see PaintContext |
|
45 |
* @see Color |
|
46 |
* @see GradientPaint |
|
47 |
* @see TexturePaint |
|
48 |
* @see Graphics2D#setPaint |
|
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
49 |
* @version 1.36, 06/05/07 |
2 | 50 |
*/ |
51 |
||
52 |
public interface Paint extends Transparency { |
|
53 |
/** |
|
54 |
* Creates and returns a {@link PaintContext} used to |
|
55 |
* generate the color pattern. |
|
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
56 |
* The arguments to this method convey additional information |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
57 |
* about the rendering operation that may be |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
58 |
* used or ignored on various implementations of the {@code Paint} interface. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
59 |
* A caller must pass non-{@code null} values for all of the arguments |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
60 |
* except for the {@code ColorModel} argument which may be {@code null} to |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
61 |
* indicate that no specific {@code ColorModel} type is preferred. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
62 |
* Implementations of the {@code Paint} interface are allowed to use or ignore |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
63 |
* any of the arguments as makes sense for their function, and are |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
64 |
* not constrained to use the specified {@code ColorModel} for the returned |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
65 |
* {@code PaintContext}, even if it is not {@code null}. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
66 |
* Implementations are allowed to throw {@code NullPointerException} for |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
67 |
* any {@code null} argument other than the {@code ColorModel} argument, |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
68 |
* but are not required to do so. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
69 |
* |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
70 |
* @param cm the preferred {@link ColorModel} which represents the most convenient |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
71 |
* format for the caller to receive the pixel data, or {@code null} |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
72 |
* if there is no preference. |
2 | 73 |
* @param deviceBounds the device space bounding box |
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
74 |
* of the graphics primitive being rendered. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
75 |
* Implementations of the {@code Paint} interface |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
76 |
* are allowed to throw {@code NullPointerException} |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
77 |
* for a {@code null} {@code deviceBounds}. |
2 | 78 |
* @param userBounds the user space bounding box |
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
79 |
* of the graphics primitive being rendered. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
80 |
* Implementations of the {@code Paint} interface |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
81 |
* are allowed to throw {@code NullPointerException} |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
82 |
* for a {@code null} {@code userBounds}. |
2 | 83 |
* @param xform the {@link AffineTransform} from user |
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
84 |
* space into device space. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
85 |
* Implementations of the {@code Paint} interface |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
86 |
* are allowed to throw {@code NullPointerException} |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
87 |
* for a {@code null} {@code xform}. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
88 |
* @param hints the set of hints that the context object can use to |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
89 |
* choose between rendering alternatives. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
90 |
* Implementations of the {@code Paint} interface |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
91 |
* are allowed to throw {@code NullPointerException} |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
92 |
* for a {@code null} {@code hints}. |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
93 |
* @return the {@code PaintContext} for |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
94 |
* generating color patterns. |
2 | 95 |
* @see PaintContext |
436
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
96 |
* @see ColorModel |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
97 |
* @see Rectangle |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
98 |
* @see Rectangle2D |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
99 |
* @see AffineTransform |
1cc586a58a3e
6573289: api/java_awt/Color/index.html#CreateContextTesttestCase4,5,6,7 fail since JDK 7 b14
dav
parents:
2
diff
changeset
|
100 |
* @see RenderingHints |
2 | 101 |
*/ |
102 |
public PaintContext createContext(ColorModel cm, |
|
103 |
Rectangle deviceBounds, |
|
104 |
Rectangle2D userBounds, |
|
105 |
AffineTransform xform, |
|
106 |
RenderingHints hints); |
|
107 |
||
108 |
} |