1 |
/* Copyright (C) 2000, 2001, 2002 Free Software Foundation |
/* GraphicsConfiguration.java -- describes characteristics of graphics |
2 |
|
Copyright (C) 2000, 2001, 2002 Free Software Foundation |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
|
/* Status: Complete, but commented out until we have the required |
|
|
GraphicsDevice. */ |
|
38 |
|
|
39 |
package java.awt; |
package java.awt; |
40 |
|
|
41 |
|
import java.awt.geom.AffineTransform; |
42 |
import java.awt.image.BufferedImage; |
import java.awt.image.BufferedImage; |
43 |
import java.awt.image.ColorModel; |
import java.awt.image.ColorModel; |
44 |
import java.awt.geom.AffineTransform; |
import java.awt.image.VolatileImage; |
45 |
|
|
46 |
|
/** |
47 |
|
* This class describes the configuration of various graphics devices, such |
48 |
|
* as a monitor or printer. Different configurations may exist for the same |
49 |
|
* device, according to the different native modes supported. |
50 |
|
* |
51 |
|
* <p>Virtual devices are supported (for example, in a multiple screen |
52 |
|
* environment, a virtual device covers all screens simultaneously); the |
53 |
|
* configuration will have a non-zero relative coordinate system in such |
54 |
|
* a case. |
55 |
|
* |
56 |
|
* @author Eric Blake <ebb9@email.byu.edu> |
57 |
|
* @see Window |
58 |
|
* @see Frame |
59 |
|
* @see GraphicsEnvironment |
60 |
|
* @see GraphicsDevice |
61 |
|
* @since 1.0 |
62 |
|
* @status updated to 1.4 |
63 |
|
*/ |
64 |
public abstract class GraphicsConfiguration |
public abstract class GraphicsConfiguration |
65 |
{ |
{ |
66 |
// Can't instantiate directly. Having a protected constructor seems |
/** |
67 |
// redundant, but that is what the docs specify. |
* The default constructor. |
68 |
|
* |
69 |
|
* @see GraphicsDevice#getConfigurations() |
70 |
|
* @see GraphicsDevice#getDefaultConfiguration() |
71 |
|
* @see GraphicsDevice#getBestConfiguration(GraphicsConfigTemplate) |
72 |
|
* @see Graphics2D#getDeviceConfiguration() |
73 |
|
*/ |
74 |
protected GraphicsConfiguration () |
protected GraphicsConfiguration () |
75 |
{ |
{ |
76 |
} |
} |
77 |
|
|
78 |
|
/** |
79 |
|
* Gets the associated device that this configuration describes. |
80 |
|
* |
81 |
|
* @return the device |
82 |
|
*/ |
83 |
public abstract GraphicsDevice getDevice(); |
public abstract GraphicsDevice getDevice(); |
84 |
|
|
85 |
public abstract BufferedImage createCompatibleImage(int width, int height); |
/** |
86 |
public abstract BufferedImage createCompatibleImage(int width, int height, |
* Returns a buffered image optimized to this device, so that blitting can |
87 |
|
* be supported in the buffered image. |
88 |
|
* |
89 |
|
* @param w the width of the buffer |
90 |
|
* @param h the height of the buffer |
91 |
|
* @return the buffered image, or null if none is supported |
92 |
|
*/ |
93 |
|
public abstract BufferedImage createCompatibleImage(int w, int h); |
94 |
|
|
95 |
|
/** |
96 |
|
* Returns a buffered volatile image optimized to this device, so that |
97 |
|
* blitting can be supported in the buffered image. Because the buffer is |
98 |
|
* volatile, it can be optimized by native graphics accelerators. |
99 |
|
* |
100 |
|
* @param w the width of the buffer |
101 |
|
* @param h the height of the buffer |
102 |
|
* @return the buffered image, or null if none is supported |
103 |
|
* @see Component#createVolatileImage(int, int) |
104 |
|
* @since 1.4 |
105 |
|
*/ |
106 |
|
public abstract VolatileImage createCompatibleVolatileImage(int w, int h); |
107 |
|
|
108 |
|
/** |
109 |
|
* Returns a buffered volatile image optimized to this device, and with the |
110 |
|
* given capabilities, so that blitting can be supported in the buffered |
111 |
|
* image. Because the buffer is volatile, it can be optimized by native |
112 |
|
* graphics accelerators. |
113 |
|
* |
114 |
|
* @param w the width of the buffer |
115 |
|
* @param h the height of the buffer |
116 |
|
* @param caps the desired capabilities of the image buffer |
117 |
|
* @return the buffered image, or null if none is supported |
118 |
|
* @throws AWTException if the capabilities cannot be met |
119 |
|
* @since 1.4 |
120 |
|
*/ |
121 |
|
public VolatileImage createCompatibleVolatileImage(int w, int h, |
122 |
|
ImageCapabilities caps) |
123 |
|
throws AWTException |
124 |
|
{ |
125 |
|
throw new AWTException("not implemented"); |
126 |
|
} |
127 |
|
|
128 |
|
/** |
129 |
|
* Returns a buffered image optimized to this device, and with the specified |
130 |
|
* transparency, so that blitting can be supported in the buffered image. |
131 |
|
* |
132 |
|
* @param w the width of the buffer |
133 |
|
* @param h the height of the buffer |
134 |
|
* @param transparency the transparency of the buffer |
135 |
|
* @return the buffered image, or null if none is supported |
136 |
|
* @see Transparency#OPAQUE |
137 |
|
* @see Transparency#BITMASK |
138 |
|
* @see Transparency#TRANSLUCENT |
139 |
|
*/ |
140 |
|
public abstract BufferedImage createCompatibleImage(int w, int h, |
141 |
int transparency); |
int transparency); |
142 |
|
|
143 |
|
/** |
144 |
|
* Gets the color model of the corresponding device. |
145 |
|
* |
146 |
|
* @return the color model |
147 |
|
*/ |
148 |
public abstract ColorModel getColorModel(); |
public abstract ColorModel getColorModel(); |
149 |
|
|
150 |
|
/** |
151 |
|
* Gets a color model for the corresponding device which supports the desired |
152 |
|
* transparency level. |
153 |
|
* |
154 |
|
* @param transparency the transparency of the model |
155 |
|
* @return the color model, with transparency |
156 |
|
* @see Transparency#OPAQUE |
157 |
|
* @see Transparency#BITMASK |
158 |
|
* @see Transparency#TRANSLUCENT |
159 |
|
*/ |
160 |
public abstract ColorModel getColorModel(int transparency); |
public abstract ColorModel getColorModel(int transparency); |
161 |
|
|
162 |
|
/** |
163 |
|
* Returns a transform that maps user coordinates to device coordinates. The |
164 |
|
* preferred mapping is about 72 user units to 1 inch (2.54 cm) of physical |
165 |
|
* space. This is often the identity transform. The device coordinates have |
166 |
|
* the origin at the upper left, with increasing x to the right, and |
167 |
|
* increasing y to the bottom. |
168 |
|
* |
169 |
|
* @return the transformation from user space to device space |
170 |
|
* @see #getNormalizingTransform() |
171 |
|
*/ |
172 |
public abstract AffineTransform getDefaultTransform(); |
public abstract AffineTransform getDefaultTransform(); |
173 |
|
|
174 |
|
/** |
175 |
|
* Returns a transform that maps user coordinates to device coordinates. The |
176 |
|
* exact mapping is 72 user units to 1 inch (2.54 cm) of physical space. |
177 |
|
* This is often the identity transform. The device coordinates have the |
178 |
|
* origin at the upper left, with increasing x to the right, and increasing |
179 |
|
* y to the bottom. Note that this is more accurate (and thus, sometimes more |
180 |
|
* costly) than the default transform. |
181 |
|
* |
182 |
|
* @return the normalized transformation from user space to device space |
183 |
|
* @see #getDefaultTransform() |
184 |
|
*/ |
185 |
public abstract AffineTransform getNormalizingTransform(); |
public abstract AffineTransform getNormalizingTransform(); |
186 |
|
|
187 |
/* @since 1.3 */ |
/** |
188 |
|
* Returns the bounds of the configuration, in device coordinates. If this |
189 |
|
* is a virtual device (for example, encompassing several screens), the |
190 |
|
* bounds may have a non-zero origin. |
191 |
|
* |
192 |
|
* @return the device bounds |
193 |
|
* @since 1.3 |
194 |
|
*/ |
195 |
public abstract Rectangle getBounds(); |
public abstract Rectangle getBounds(); |
196 |
} |
|
197 |
|
/** |
198 |
|
* Returns the buffering capabilities of this configuration. |
199 |
|
* |
200 |
|
* @return the buffer capabilities |
201 |
|
* @since 1.4 |
202 |
|
*/ |
203 |
|
public BufferCapabilities getBufferCapabilities() |
204 |
|
{ |
205 |
|
throw new Error("not implemented"); |
206 |
|
} |
207 |
|
|
208 |
|
/** |
209 |
|
* Returns the imaging capabilities of this configuration. |
210 |
|
* |
211 |
|
* @return the image capabilities |
212 |
|
* @since 1.4 |
213 |
|
*/ |
214 |
|
public ImageCapabilities getImageCapabilities() |
215 |
|
{ |
216 |
|
throw new Error("not implemented"); |
217 |
|
} |
218 |
|
} // class GraphicsConfiguration |