GraphicsConfiguration class describes the
characteristics of a graphics destination such as a printer or monitor.
There can be many GraphicsConfiguration objects associated
with a single graphics device, representing different drawing modes or
capabilities. The corresponding native structure will vary from platform
to platform. For example, on X11 windowing systems,
each visual is a different GraphicsConfiguration.
On Microsoft Windows, GraphicsConfigurations represent
PixelFormats available in the current resolution and color depth.
In a virtual device multi-screen environment in which the desktop
area could span multiple physical screen devices, the bounds of the
GraphicsConfiguration objects are relative to the
virtual coordinate system. When setting the location of a
component, use getBounds to get the bounds of
the desired GraphicsConfiguration and offset the location
with the coordinates of the GraphicsConfiguration,
as the following code sample illustrates:
Frame f = new Frame(gc); // where gc is a GraphicsConfiguration
Rectangle bounds = gc.getBounds();
f.setLocation(10 + bounds.x, 10 + bounds.y);
To determine if your environment is a virtual device
environment, call getBounds on all of the
GraphicsConfiguration objects in your system. If
any of the origins of the returned bounds is not (0, 0),
your environment is a virtual device environment.
You can also use getBounds to determine the bounds
of the virtual device. To do this, first call getBounds on all
of the GraphicsConfiguration objects in your
system. Then calculate the union of all of the bounds returned
from the calls to getBounds. The union is the
bounds of the virtual device. The following code sample
calculates the bounds of the virtual device.
Rectangle virtualBounds = new Rectangle();
GraphicsEnvironment ge = GraphicsEnvironment.
getLocalGraphicsEnvironment();
GraphicsDevice[] gs =
ge.getScreenDevices();
for (int j = 0; j < gs.length; j++) {
GraphicsDevice gd = gs[j];
GraphicsConfiguration[] gc =
gd.getConfigurations();
for (int i=0; i < gc.length; i++) {
virtualBounds =
virtualBounds.union(gc[i].getBounds());
}
}
Window, Frame, GraphicsEnvironment, GraphicsDevice
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static BufferCapabilities | |
| private static ImageCapabilities |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public BufferedImage | Returns: aBufferedImage whose data layout and color
model is compatible with this GraphicsConfiguration.the width of the returned width, int BufferedImagethe height of the returned height)BufferedImageReturns a |
| public BufferedImage | Returns: aBufferedImage whose data layout and color
model is compatible with this GraphicsConfiguration
and also supports the specified transparency.the width of the returned width, int BufferedImagethe height of the returned height, int BufferedImagethe specified transparency mode transparency)Returns a |
| public VolatileImage | Returns: aVolatileImage whose data layout and color
model is compatible with this GraphicsConfiguration.the width of the returned width, int VolatileImagethe height of the returned height)VolatileImageReturns a |
| public VolatileImage | Returns: aVolatileImage whose data layout and color
model is compatible with this GraphicsConfiguration.the width of the returned width, int VolatileImagethe height of the returned height, int VolatileImagethe specified transparency mode transparency)Returns a |
| public VolatileImage | Returns: aVolatileImage whose data layout and color
model is compatible with this GraphicsConfiguration.the width of the returned width, int VolatileImagethe height of the returned height, ImageCapabilities VolatileImagethe image capabilities caps)Returns a |
| public VolatileImage | Returns: aVolatileImage whose data layout and color
model is compatible with this GraphicsConfiguration.the width of the returned width, int VolatileImagethe height of the returned height, ImageCapabilities VolatileImagethe image capabilities caps, int the specified transparency mode transparency)Returns a |
| public abstract Rectangle | Returns: the bounds of the area covered by thisGraphicsConfiguration.Returns the bounds of the |
| public BufferCapabilities | Returns: the buffering capabilities of this graphics configuration objectReturns the buffering capabilities of this
|
| public abstract ColorModel | Returns: aColorModel object that is associated with
this GraphicsConfiguration.Returns the |
| public abstract ColorModel | Returns: aColorModel object that is associated with
this GraphicsConfiguration and supports the
specified transparency or null if the transparency is not a valid
value.the specified transparency mode transparency)Returns the |
| public abstract AffineTransform | Returns: the defaultAffineTransform for this
GraphicsConfiguration.Returns the default |
| public abstract GraphicsDevice | Returns: aGraphicsDevice object that is
associated with this GraphicsConfiguration.Returns the |
| public ImageCapabilities | Returns: the image capabilities of this graphics configuration objectReturns the image capabilities of this
|
| public abstract AffineTransform | Returns: anAffineTransform to concatenate to the
default AffineTransform so that 72 units in user
space is mapped to 1 inch in device space.Returns an |
| public boolean | Returns: whether the given GraphicsConfiguration supports the translucency effects.Returns whether this |
| defaultBufferCaps | back to summary |
|---|---|
| private static BufferCapabilities defaultBufferCaps | |
| defaultImageCaps | back to summary |
|---|---|
| private static ImageCapabilities defaultImageCaps | |
| GraphicsConfiguration | back to summary |
|---|---|
| protected GraphicsConfiguration() This is an abstract class that cannot be instantiated directly. Instances must be obtained from a suitable factory or query method. | |
| createCompatibleImage | back to summary |
|---|---|
| public BufferedImage createCompatibleImage(int width, int height) Returns a
| |
| createCompatibleImage | back to summary |
|---|---|
| public BufferedImage createCompatibleImage(int width, int height, int transparency) Returns a
| |
| createCompatibleVolatileImage | back to summary |
|---|---|
| public VolatileImage createCompatibleVolatileImage(int width, int height) Returns a
| |
| createCompatibleVolatileImage | back to summary |
|---|---|
| public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency) Returns a
| |
| createCompatibleVolatileImage | back to summary |
|---|---|
| public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException Returns a
| |
| createCompatibleVolatileImage | back to summary |
|---|---|
| public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency) throws AWTException Returns a
| |
| getBounds | back to summary |
|---|---|
| public abstract Rectangle getBounds() Returns the bounds of the
| |
| getBufferCapabilities | back to summary |
|---|---|
| public BufferCapabilities getBufferCapabilities() Returns the buffering capabilities of this
| |
| getColorModel | back to summary |
|---|---|
| public abstract ColorModel getColorModel() Returns the
| |
| getColorModel | back to summary |
|---|---|
| public abstract ColorModel getColorModel(int transparency) Returns the
| |
| getDefaultTransform | back to summary |
|---|---|
| public abstract AffineTransform getDefaultTransform() Returns the default
| |
| getDevice | back to summary |
|---|---|
| public abstract GraphicsDevice getDevice() Returns the
| |
| getImageCapabilities | back to summary |
|---|---|
| public ImageCapabilities getImageCapabilities() Returns the image capabilities of this
| |
| getNormalizingTransform | back to summary |
|---|---|
| public abstract AffineTransform getNormalizingTransform() Returns an
For a particular
GraphicsConfiguration gc = g.getDeviceConfiguration();
g.setTransform(gc.getDefaultTransform());
g.transform(gc.getNormalizingTransform());
Note that sometimes this AffineTransform is identity,
such as for printers or metafile output, and that this
AffineTransform is only as accurate as the information
supplied by the underlying system. For image buffers not
associated with a device, such as those not created by
createCompatibleImage, this
AffineTransform is the Identity transform
since there is no valid distance measurement.
| |
| isTranslucencyCapable | back to summary |
|---|---|
| public boolean isTranslucencyCapable() Returns whether this
| |
| Access | Constructor and Description |
|---|---|
| public |
| DefaultBufferCapabilities | back to summary |
|---|---|
| public DefaultBufferCapabilities(ImageCapabilities imageCaps) | |