public abstract class GraphicsConfiguration extends Object
GraphicsConfiguration
类描述图形的目的地如打印机或显示器的特点。可能有一个单一的图形设备相关的许多
GraphicsConfiguration
对象,代表不同的绘图模式或能力。相应的原生结构将从平台到平台。例如,在X11窗口系统,每个视觉是不同的
GraphicsConfiguration
。在微软Windows,
GraphicsConfiguration
s代表当前的分辨率和颜色深度可pixelformats。
在虚拟设备的多屏幕环境中的桌面区域可以跨越多个物理屏幕设备,GraphicsConfiguration
对象的范围是相对于虚拟坐标系统。设置组件的位置时,使用getBounds
得到所需的GraphicsConfiguration
范围和对GraphicsConfiguration
坐标偏移的位置,如下面的代码示例演示:
架F =新的帧(GC);//在GC是一个graphicsconfiguration矩形边界= getbounds() GC;f.setlocation(10 + 10 +界限。X、Y的范围。);
要确定你的环境是一个虚拟的设备环境,呼吁所有在您的系统GraphicsConfiguration
对象getBounds
。如果返回的界限并不起源(0, 0),你的环境是一个虚拟设备环境。
你也可以使用getBounds
确定虚拟设备的范围。要做到这一点,对所有在您的系统GraphicsConfiguration
对象第一次打电话getBounds
。然后计算所有边界的联盟从调用返回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()
这是一个抽象类不能被直接实例化。
|
Modifier and Type | Method and Description |
---|---|
BufferedImage |
createCompatibleImage(int width, int height)
返回一个数据布局和颜色模型,这
GraphicsConfiguration 兼容
BufferedImage 。
|
BufferedImage |
createCompatibleImage(int width, int height, int transparency)
返回一个支持指定的透明度和具有数据布局和颜色模型,这
GraphicsConfiguration 兼容
BufferedImage 。
|
VolatileImage |
createCompatibleVolatileImage(int width, int height)
返回一个数据布局和颜色模型,这
GraphicsConfiguration 兼容
VolatileImage 。
|
VolatileImage |
createCompatibleVolatileImage(int width, int height, ImageCapabilities caps)
返回一个数据布局和颜色模型,这
GraphicsConfiguration 兼容
VolatileImage ,使用指定的图像的能力。
|
VolatileImage |
createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency)
返回一个
VolatileImage 与数据布局和颜色模型,这
GraphicsConfiguration 兼容,使用指定的图像的能力和透明度值。
|
VolatileImage |
createCompatibleVolatileImage(int width, int height, int transparency)
返回一个数据布局和颜色模型,这
GraphicsConfiguration 兼容
VolatileImage 。
|
abstract Rectangle |
getBounds()
返回在设备的
GraphicsConfiguration 边界坐标。
|
BufferCapabilities |
getBufferCapabilities()
返回该
GraphicsConfiguration 缓冲能力。
|
abstract ColorModel |
getColorModel()
返回与此相关的
ColorModel
GraphicsConfiguration 。
|
abstract ColorModel |
getColorModel(int transparency)
返回与此
GraphicsConfiguration 支持指定透明度相关的
ColorModel 。
|
abstract AffineTransform |
getDefaultTransform()
返回此
GraphicsConfiguration 默认
AffineTransform 。
|
abstract GraphicsDevice |
getDevice()
返回与此相关的
GraphicsDevice
GraphicsConfiguration 。
|
ImageCapabilities |
getImageCapabilities()
返回该
GraphicsConfiguration 图像能力。
|
abstract AffineTransform |
getNormalizingTransform()
返回一个
AffineTransform 可与一个
GraphicsConfiguration 默认
AffineTransform 使72台在用户空间等于1英寸的级联装置空间。
|
boolean |
isTranslucencyCapable()
是否这
GraphicsConfiguration 支持半透明
PERPIXEL_TRANSLUCENT 种。
|
protected GraphicsConfiguration()
public abstract GraphicsDevice getDevice()
GraphicsDevice
GraphicsConfiguration
。
GraphicsDevice
对象,与此相关的
GraphicsConfiguration
。
public BufferedImage createCompatibleImage(int width, int height)
GraphicsConfiguration
兼容
BufferedImage
。这种方法没有内存映射设备。返回的
BufferedImage
有布局和颜色模型是最接近这个本地设备的配置和可优化放到这个装置。
width
-返回的
BufferedImage
宽度
height
-返回的
BufferedImage
高度
BufferedImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容。
public BufferedImage createCompatibleImage(int width, int height, int transparency)
BufferedImage
支持指定的透明度和数据布局和颜色模型,这
GraphicsConfiguration
兼容。这种方法与内存映射一个设备无关。返回的
BufferedImage
有布局和颜色模型,可以优化放到一本
GraphicsConfiguration
装置。
width
-返回的
BufferedImage
宽度
height
-返回的
BufferedImage
高度
transparency
-指定透明模式
BufferedImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容并支持指定的透明度。
IllegalArgumentException
如果透明度不是有效值
Transparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
public VolatileImage createCompatibleVolatileImage(int width, int height)
GraphicsConfiguration
兼容
VolatileImage
。返回的
VolatileImage
可能存储优化的底层图形设备因此可能特定于平台的渲染加速效益数据。
width
-返回的
VolatileImage
宽度
height
-返回的
VolatileImage
高度
VolatileImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容。
Component.createVolatileImage(int, int)
public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
GraphicsConfiguration
兼容
VolatileImage
。返回的
VolatileImage
可能存储优化的底层图形设备因此可能特定于平台的渲染加速效益数据。
width
-返回的
VolatileImage
宽度
height
-返回的
VolatileImage
高度
transparency
-指定透明模式
VolatileImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容。
IllegalArgumentException
如果透明度不是有效值
Transparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
,
Component.createVolatileImage(int, int)
public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException
GraphicsConfiguration
兼容
VolatileImage
,使用指定的图像的能力。如果
caps
参数为空,它有效地忽略,此方法将创建一个volatileimage不顾
ImageCapabilities
约束。返回的
VolatileImage
有布局和颜色模型是最接近这个本地设备的配置和可优化放到这个装置。
width
-返回的
VolatileImage
宽度
height
-返回的
VolatileImage
高度
caps
-图像的能力
VolatileImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容。
AWTException
-如果提供的图像的能力不能满足这个图形组态
public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency) throws AWTException
GraphicsConfiguration
兼容
VolatileImage
,使用指定的图像的能力和透明度值。如果
caps
参数为空,它有效地忽略,此方法将创建一个volatileimage不顾
ImageCapabilities
约束。返回的
VolatileImage
有布局和颜色模型是最接近这个本地设备的配置和可优化放到这个装置。
width
-返回的
VolatileImage
宽度
height
-返回的
VolatileImage
高度
caps
-图像的能力
transparency
-指定透明模式
VolatileImage
的数据布局和颜色模型是这
GraphicsConfiguration
兼容。
IllegalArgumentException
如果透明度不是有效值
AWTException
-如果提供的图像的能力不能满足这个图形组态
Transparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
,
Component.createVolatileImage(int, int)
public abstract ColorModel getColorModel()
ColorModel
GraphicsConfiguration
。
ColorModel
对象,与此相关的
GraphicsConfiguration
。
public abstract ColorModel getColorModel(int transparency)
GraphicsConfiguration
支持指定透明度相关的
ColorModel
。
transparency
-指定透明模式
ColorModel
对象,这
GraphicsConfiguration
相关和支持指定透明度或null如果透明度不是有效值。
Transparency.OPAQUE
,
Transparency.BITMASK
,
Transparency.TRANSLUCENT
public abstract AffineTransform getDefaultTransform()
GraphicsConfiguration
默认
AffineTransform
。这
AffineTransform
通常是恒等变换对于大多数正常屏幕。默认
AffineTransform
Map坐标到设备上,72的用户空间坐标单位测量约1英寸的设备空间。归一化变换可以被用来使这个映射更精确。在屏幕和打印机设备的默认
AffineTransform
定义坐标系的空间坐标的设备的目标区域左上角的X坐标原点,增加的权利和Y坐标增加向下。与设备无关的图像缓冲区,如那些由
createCompatibleImage
没有创造,这是
AffineTransform
恒等变换。
GraphicsConfiguration
默认
AffineTransform
。
public abstract AffineTransform getNormalizingTransform()
AffineTransform
可与一个
GraphicsConfiguration
默认
AffineTransform
使72台在用户空间等于1英寸的级联装置空间。
对于一个特定的Graphics2D
,G,一个可以重置用下面的伪代码创建一个映射变换:
graphicsconfiguration GC = G getdeviceconfiguration();g.settransform(GC。getdefaulttransform());g.transform(GC。getnormalizingtransform());注意,有时这
AffineTransform
是身份,如打印机或文件输出,并认为这
AffineTransform
是准确的底层系统提供的信息。与设备无关的图像缓冲区,如那些由
createCompatibleImage
没有创造,这是
AffineTransform
恒等变换由于没有有效的距离测量。
AffineTransform
连接到默认的
AffineTransform
使72单位在用户空间映射到设备空间1英寸。
public abstract Rectangle getBounds()
GraphicsConfiguration
边界坐标。在一个虚拟设备的多屏幕环境中,边界可以有负的X或Y的起源。
GraphicsConfiguration
界限。
public BufferCapabilities getBufferCapabilities()
GraphicsConfiguration
缓冲能力。
public ImageCapabilities getImageCapabilities()
GraphicsConfiguration
图像能力。
public boolean isTranslucencyCapable()
GraphicsConfiguration
支持半透明
PERPIXEL_TRANSLUCENT
种。
Window.setBackground(Color)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.