public abstract class GraphicsConfiguration extends Object
GraphicsConfiguration クラスは、プリンタやモニターなどのグラフィックスデスティネーションの特性を記述します。1 つのグラフィックスデバイスには、異なる描画モードまたは機能を表す多くの関連する GraphicsConfiguration があります。対応するネイティブ構造はプラットフォーム間で異なります。たとえば、X11 ウィンドウシステムでは、各表示はそれぞれ異なる GraphicsConfiguration です。Microsoft Windows では、GraphicsConfiguration は現在の解像度と色深度で使用できる 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);
環境が仮想デバイス環境かどうかを判定するには、システムにあるすべての 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| 修飾子 | コンストラクタと説明 |
|---|---|
protected |
GraphicsConfiguration()
これは、インスタンスを直接には生成できない abstract クラスです。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
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)
指定されたイメージ機能と透明度の値を使用して、この
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。 |
VolatileImage |
createCompatibleVolatileImage(int width, int height, int transparency)
この
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。 |
abstract Rectangle |
getBounds()
デバイス座標内の
GraphicsConfiguration の境界を返します。 |
BufferCapabilities |
getBufferCapabilities()
この
GraphicsConfiguration のバッファリング機能を返します。 |
abstract ColorModel |
getColorModel()
この
GraphicsConfiguration に関連付けられた ColorModel を返します。 |
abstract ColorModel |
getColorModel(int transparency)
指定された透明度をサポートする、この
GraphicsConfiguration に関連付けられた ColorModel を返します。 |
abstract AffineTransform |
getDefaultTransform()
この
GraphicsConfiguration のデフォルトの AffineTransform を返します。 |
abstract GraphicsDevice |
getDevice()
この
GraphicsConfiguration に関連付けられた GraphicsDevice を返します。 |
ImageCapabilities |
getImageCapabilities()
この
GraphicsConfiguration のイメージ機能を返します。 |
abstract AffineTransform |
getNormalizingTransform()
ユーザー空間内の 72 単位がデバイス空間内の 1 インチに等しくなるように、
GraphicsConfiguration のデフォルトの AffineTransform に連結できる AffineTransform を返します。 |
boolean |
isTranslucencyCapable()
この
GraphicsConfiguration が半透明性の種類 PERPIXEL_TRANSLUCENT をサポートしているかどうかを返します。 |
protected GraphicsConfiguration()
public abstract GraphicsDevice getDevice()
GraphicsConfiguration に関連付けられた GraphicsDevice を返します。GraphicsConfiguration に関連付けられた GraphicsDevice オブジェクト。public BufferedImage createCompatibleImage(int width, int height)
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ BufferedImage を返します。このメソッドは、デバイスをメモリーマッピングすることとは無関係です。返された BufferedImage は、このネイティブなデバイス構成にもっとも近いレイアウトとカラーモデルを持っているため、このデバイスに最適にブリットできます。width - 返された次の幅: BufferedImageheight - 返された次の高さ: BufferedImageGraphicsConfiguration と互換性のある BufferedImage。public BufferedImage createCompatibleImage(int width, int height, int transparency)
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ BufferedImage を返します。このメソッドは、デバイスをメモリーマッピングすることとは無関係です。返される BufferedImage は、この GraphicsConfiguration を持つデバイスに最適にブリットできるレイアウトおよびカラーモデルを持ちます。width - 返された次の幅: BufferedImageheight - 返された次の高さ: BufferedImagetransparency - 指定された透明度モードGraphicsConfiguration と互換性があり、指定された透明度をサポートする BufferedImage。IllegalArgumentException - 透明度が有効な値でない場合Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENTpublic VolatileImage createCompatibleVolatileImage(int width, int height)
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。返された VolatileImage には、基本となるグラフィックスデバイスのために最適に格納されたデータが含まれている可能性があるため、プラットフォーム固有の描画の高速化の利点が得られる可能性があります。width - 返された次の幅: VolatileImageheight - 返された次の高さ: VolatileImageGraphicsConfiguration と互換性のある VolatileImage。Component.createVolatileImage(int, int)public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。返された VolatileImage には、基本となるグラフィックスデバイスのために最適に格納されたデータが含まれている可能性があるため、プラットフォーム固有の描画の高速化の利点が得られる可能性があります。width - 返された次の幅: VolatileImageheight - 返された次の高さ: VolatileImagetransparency - 指定された透明度モードGraphicsConfiguration と互換性のある VolatileImage。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 パラメータが null である場合は、このパラメータが事実上無視され、このメソッドは ImageCapabilities 制約には関係なく VolatileImage を作成します。
返された VolatileImage は、このネイティブなデバイス構成にもっとも近いレイアウトとカラーモデルを持っているため、このデバイスに最適にブリットできます。width - 返された次の幅: VolatileImageheight - 返された次の高さ: VolatileImagecaps - イメージ機能GraphicsConfiguration と互換性のある VolatileImage。AWTException - 指定されたイメージ機能をこのグラフィックス構成が満足できなかった場合public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency) throws AWTException
GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。caps パラメータが null である場合は、このパラメータが事実上無視され、このメソッドは ImageCapabilities 制約には関係なく VolatileImage を作成します。
返された VolatileImage は、このネイティブなデバイス構成にもっとも近いレイアウトとカラーモデルを持っているため、このデバイスに最適にブリットできます。width - 返された次の幅: VolatileImageheight - 返された次の高さ: VolatileImagecaps - イメージ機能transparency - 指定された透明度モードGraphicsConfiguration と互換性のある VolatileImage。IllegalArgumentException - 透明度が有効な値でない場合AWTException - 指定されたイメージ機能をこのグラフィックス構成が満足できなかった場合Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT, Component.createVolatileImage(int, int)public abstract ColorModel getColorModel()
GraphicsConfiguration に関連付けられた ColorModel を返します。GraphicsConfiguration に関連付けられた ColorModel オブジェクト。public abstract ColorModel getColorModel(int transparency)
GraphicsConfiguration に関連付けられた ColorModel を返します。transparency - 指定された透明度モードGraphicsConfiguration に関連し、指定された透明度をサポートする ColorModel オブジェクト。透明度が有効な値でない場合は null。Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENTpublic abstract AffineTransform getDefaultTransform()
GraphicsConfiguration のデフォルトの AffineTransform を返します。この AffineTransform は通常、ほとんどの標準画面では恒等変換になります。デフォルトの AffineTransform は、72 ユーザー空間座標単位がデバイス空間のおよそ 1 インチに対応するようにデバイスに座標をマッピングします。正規化変換を使用すると、このマッピングをより正確にすることができます。画面デバイスとプリンタデバイスのデフォルトの AffineTransform で定義されている座標空間の座標は、デバイスのターゲット領域の左上隅に原点を持ち、X 座標は右方向に、Y 座標は下方向に値が増加します。createCompatibleImage で作成されない、デバイスに関連していないイメージバッファーなどでは、この AffineTransform は恒等変換になります。GraphicsConfiguration のデフォルトの AffineTransform。public abstract AffineTransform getNormalizingTransform()
GraphicsConfiguration のデフォルトの AffineTransform に連結できる AffineTransform を返します。
g という特定の Graphics2D では、次の擬似コードを使って変換をリセットし、このようなマッピングを作成できます。
GraphicsConfiguration gc = g.getDeviceConfiguration();
g.setTransform(gc.getDefaultTransform());
g.transform(gc.getNormalizingTransform());
ただし、この AffineTransform は場合によって、たとえばプリンタ出力やメタファイル出力の場合に恒等変換になり、この AffineTransform の正確さは元にあるシステムによって指定される情報と同じ程度になります。createCompatibleImage で作成されない、デバイスに関連していないイメージバッファーなどでは、有効な距離測定法がないため、この AffineTransform は恒等変換になります。AffineTransform に連結する AffineTransform。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) バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.