Spec-Zone .ru
спецификации, руководства, описания, API
|
public abstract class GraphicsConfiguration extends Object
GraphicsConfiguration
класс описывает характеристики графического места назначения, такие как принтер или монитор. Могут быть многие GraphicsConfiguration
объекты, связанные с единственным графическим устройством, представляя различные режимы рисунка или возможности. Соответствующая собственная структура изменится от платформы до платформы. Например, на системах управления окнами X11, каждый визуальный является различным GraphicsConfiguration
. На Microsoft Windows, GraphicsConfiguration
s представляют PixelFormats, доступный в текущем разрешении и глубине цвета. В виртуальном устройстве многоэкранная среда, в которой настольная область могла охватить многократные физические экранные устройства, границы GraphicsConfiguration
объекты относительно виртуальной системы координат. Устанавливая расположение компонента, использовать getBounds
получить границы требуемого GraphicsConfiguration
и смещение расположение с координатами GraphicsConfiguration
, поскольку следующий пример кода иллюстрирует:
Frame f = new Frame(gc); // where gc is a GraphicsConfiguration Rectangle bounds = gc.getBounds(); f.setLocation(10 + bounds.x, 10 + bounds.y);
Чтобы определить, является ли Ваша среда средой виртуального устройства, вызвать getBounds
на всем из GraphicsConfiguration
объекты в Вашей системе. Если какой-либо из источников возвращенных границ не (0, 0), Ваша среда является средой виртуального устройства.
Можно также использовать getBounds
определить границы виртуального устройства. Чтобы сделать это, сначала вызовите getBounds
на всем из GraphicsConfiguration
объекты в Вашей системе. Затем вычислите объединение всех границ, возвращенных из звонков getBounds
. Объединение является границами виртуального устройства. Следующий пример кода вычисляет границы виртуального устройства.
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 | Constructor and Description |
---|---|
protected |
GraphicsConfiguration()
This is an abstract class that cannot be instantiated directly.
|
Modifier and Type | Method and Description |
---|---|
BufferedImage |
createCompatibleImage(int width,
int height)
Returns a
BufferedImage with a data layout and color model
compatible with this GraphicsConfiguration . |
BufferedImage |
createCompatibleImage(int width,
int height,
int transparency)
Returns a
BufferedImage that supports the specified
transparency and has a data layout and color model
compatible with this GraphicsConfiguration . |
VolatileImage |
createCompatibleVolatileImage(int width,
int height)
Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration . |
VolatileImage |
createCompatibleVolatileImage(int width,
int height,
ImageCapabilities caps)
Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration , using
the specified image capabilities. |
VolatileImage |
createCompatibleVolatileImage(int width,
int height,
ImageCapabilities caps,
int transparency)
Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration , using
the specified image capabilities and transparency value. |
VolatileImage |
createCompatibleVolatileImage(int width,
int height,
int transparency)
Returns a
VolatileImage with a data layout and color model
compatible with this GraphicsConfiguration . |
abstract Rectangle |
getBounds()
Returns the bounds of the
GraphicsConfiguration
in the device coordinates. |
BufferCapabilities |
getBufferCapabilities()
Returns the buffering capabilities of this
GraphicsConfiguration . |
abstract ColorModel |
getColorModel()
Returns the
ColorModel associated with this
GraphicsConfiguration . |
abstract ColorModel |
getColorModel(int transparency)
Returns the
ColorModel associated with this
GraphicsConfiguration that supports the specified
transparency. |
abstract AffineTransform |
getDefaultTransform()
Returns the default
AffineTransform for this
GraphicsConfiguration . |
abstract GraphicsDevice |
getDevice()
Returns the
GraphicsDevice associated with this
GraphicsConfiguration . |
ImageCapabilities |
getImageCapabilities()
Returns the image capabilities of this
GraphicsConfiguration . |
abstract AffineTransform |
getNormalizingTransform()
Returns a
AffineTransform that can be concatenated
with the default AffineTransform
of a GraphicsConfiguration so that 72 units in user
space equals 1 inch in device space. |
boolean |
isTranslucencyCapable()
Returns whether this
GraphicsConfiguration supports
the PERPIXEL_TRANSLUCENT kind of translucency. |
protected GraphicsConfiguration()
public abstract GraphicsDevice getDevice()
GraphicsDevice
associated with this
GraphicsConfiguration
.GraphicsDevice
object that is
associated with this GraphicsConfiguration
.public BufferedImage createCompatibleImage(int width, int height)
BufferedImage
with a data layout and color model
compatible with this GraphicsConfiguration
. This
method has nothing to do with memory-mapping
a device. The returned BufferedImage
has
a layout and color model that is closest to this native device
configuration and can therefore be optimally blitted to this
device.width
- the width of the returned BufferedImage
height
- the height of the returned BufferedImage
BufferedImage
whose data layout and color
model is compatible with this GraphicsConfiguration
.public BufferedImage createCompatibleImage(int width, int height, int transparency)
BufferedImage
that supports the specified
transparency and has a data layout and color model
compatible with this GraphicsConfiguration
. This
method has nothing to do with memory-mapping
a device. The returned BufferedImage
has a layout and
color model that can be optimally blitted to a device
with this GraphicsConfiguration
.width
- the width of the returned BufferedImage
height
- the height of the returned BufferedImage
transparency
- the specified transparency modeBufferedImage
whose data layout and color
model is compatible with this GraphicsConfiguration
and also supports the specified transparency.IllegalArgumentException
- if the transparency is not a valid valueTransparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
public VolatileImage createCompatibleVolatileImage(int width, int height)
VolatileImage
with a data layout and color model
compatible with this GraphicsConfiguration
.
The returned VolatileImage
may have data that is stored optimally for the underlying graphics
device and may therefore benefit from platform-specific rendering
acceleration.width
- the width of the returned VolatileImage
height
- the height of the returned VolatileImage
VolatileImage
whose data layout and color
model is compatible with this GraphicsConfiguration
.Component.createVolatileImage(int, int)
public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
VolatileImage
with a data layout and color model
compatible with this GraphicsConfiguration
.
The returned VolatileImage
may have data that is stored optimally for the underlying graphics
device and may therefore benefit from platform-specific rendering
acceleration.width
- the width of the returned VolatileImage
height
- the height of the returned VolatileImage
transparency
- the specified transparency modeVolatileImage
whose data layout and color
model is compatible with this GraphicsConfiguration
.IllegalArgumentException
- if the transparency is not a valid valueTransparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
,
Component.createVolatileImage(int, int)
public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException
VolatileImage
with a data layout and color model
compatible with this GraphicsConfiguration
, using
the specified image capabilities.
If the caps
parameter is null, it is effectively ignored
and this method will create a VolatileImage without regard to
ImageCapabilities
constraints.
The returned VolatileImage
has
a layout and color model that is closest to this native device
configuration and can therefore be optimally blitted to this
device.width
- the width of the returned VolatileImage
height
- the height of the returned VolatileImage
caps
- the image capabilitiesVolatileImage
whose data layout and color
model is compatible with this GraphicsConfiguration
.AWTException
- if the supplied image capabilities could not
be met by this graphics configurationpublic VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency) throws AWTException
VolatileImage
with a data layout and color model
compatible with this GraphicsConfiguration
, using
the specified image capabilities and transparency value.
If the caps
parameter is null, it is effectively ignored
and this method will create a VolatileImage without regard to
ImageCapabilities
constraints.
The returned VolatileImage
has
a layout and color model that is closest to this native device
configuration and can therefore be optimally blitted to this
device.width
- the width of the returned VolatileImage
height
- the height of the returned VolatileImage
caps
- the image capabilitiestransparency
- the specified transparency modeVolatileImage
whose data layout and color
model is compatible with this GraphicsConfiguration
.IllegalArgumentException
- if the transparency is not a valid valueAWTException
- if the supplied image capabilities could not
be met by this graphics configurationTransparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
,
Component.createVolatileImage(int, int)
public abstract ColorModel getColorModel()
ColorModel
associated with this
GraphicsConfiguration
.ColorModel
object that is associated with
this GraphicsConfiguration
.public abstract ColorModel getColorModel(int transparency)
ColorModel
associated with this
GraphicsConfiguration
that supports the specified
transparency.transparency
- the specified transparency modeColorModel
object that is associated with
this GraphicsConfiguration
and supports the
specified transparency or null if the transparency is not a valid
value.Transparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
public abstract AffineTransform getDefaultTransform()
AffineTransform
for this
GraphicsConfiguration
. This
AffineTransform
is typically the Identity transform
for most normal screens. The default AffineTransform
maps coordinates onto the device such that 72 user space
coordinate units measure approximately 1 inch in device
space. The normalizing transform can be used to make
this mapping more exact. Coordinates in the coordinate space
defined by the default AffineTransform
for screen and
printer devices have the origin in the upper left-hand corner of
the target region of the device, with X coordinates
increasing to the right and Y coordinates increasing downwards.
For image buffers not associated with a device, such as those not
created by createCompatibleImage
,
this AffineTransform
is the Identity transform.AffineTransform
for this
GraphicsConfiguration
.public abstract AffineTransform getNormalizingTransform()
AffineTransform
that can be concatenated
with the default AffineTransform
of a GraphicsConfiguration
so that 72 units in user
space equals 1 inch in device space.
For a particular Graphics2D
, g, one
can reset the transformation to create
such a mapping by using the following pseudocode:
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.AffineTransform
to concatenate to the
default AffineTransform
so that 72 units in user
space is mapped to 1 inch in device space.public abstract Rectangle getBounds()
GraphicsConfiguration
in the device coordinates. In a multi-screen environment
with a virtual device, the bounds can have negative X
or Y origins.GraphicsConfiguration
.public BufferCapabilities getBufferCapabilities()
GraphicsConfiguration
.public ImageCapabilities getImageCapabilities()
GraphicsConfiguration
.public boolean isTranslucencyCapable()
GraphicsConfiguration
supports
the PERPIXEL_TRANSLUCENT
kind of translucency.Window.setBackground(Color)
For further API reference and developer documentation, see
Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.