JavaTM 2
Platform
Std. Ed. v1.4.0

java.awt
クラス GraphicsConfiguration

java.lang.Object
  |
  +--java.awt.GraphicsConfiguration

public abstract class GraphicsConfiguration
extends Object

GraphicsConfiguration クラスはプリンタまたはモニターなどのグラフィックスデスティネーションの特性を記述します。1 つのグラフィックスデバイスには、異なる描画モードまたは機能を表す多くの関連する GraphicsConfiguration があります。対応するネイティブ構造はプラットフォーム間で異なります。たとえば、X11 ウィンドウシステムでは、各表示はそれぞれ異なる GraphicsConfiguration です。win32 では、GraphicsConfiguration は現在の解像度と色深度で使用できる PixelFormats を表示します。

デスクトップ領域が物理的に複数の画面デバイスにまたがる仮想デバイスのマルチスクリーン環境では、GraphicsConfiguration オブジェクトの境界は、仮想の座標系を基準にしています。コンポーネントの位置を設定する場合は、次のコードサンプルで示すように、getBounds を使って目的の GraphicsConfiguration の境界を取得し、GraphicsConfiguration の座標との位置をオフセットします。

      Frame f = new Frame(GraphicsConfiguration gc);
      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 クラスです。
 
メソッドの概要
abstract  BufferedImage createCompatibleImage(int width, int height)
          この GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ BufferedImage を返します。
abstract  BufferedImage createCompatibleImage(int width, int height, int transparency)
          指定された透明度をサポートし、この GraphicsConfiguration と互換性のあるデータレイアウトおよびカラーモデルを持つ BufferedImage を返します。
abstract  VolatileImage createCompatibleVolatileImage(int width, int height)
          この GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。
 VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps)
          指定されたイメージ機能を使用して、この 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 を返します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

GraphicsConfiguration

protected GraphicsConfiguration()
インスタンスを直接生成できない abstract クラスです。インスタンスは、適切なファクトリメソッドやクエリーメソッドから取得する必要があります。

関連項目:
GraphicsDevice.getConfigurations(), GraphicsDevice.getDefaultConfiguration(), GraphicsDevice.getBestConfiguration(java.awt.GraphicsConfigTemplate), Graphics2D.getDeviceConfiguration()
メソッドの詳細

getDevice

public abstract GraphicsDevice getDevice()
この GraphicsConfiguration に関連した GraphicsDevice を返します。

戻り値:
この GraphicsConfiguration に関連した GraphicsDevice オブジェクト

createCompatibleImage

public abstract BufferedImage createCompatibleImage(int width,
                                                    int height)
この GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ BufferedImage を返します。このメソッドは、デバイスをメモリマッピングすることとは無関係です。返される BufferedImage は、このネイティブのデバイス構成にもっとも近いレイアウトおよびカラーモデルを持っているので、このデバイスに最適に Blit できます。

パラメータ:
width - 返される BufferedImage の幅
height - 返される BufferedImage の高さ
戻り値:
データレイアウトとカラーモデルがこの GraphicsConfiguration と互換性のある BufferedImage

createCompatibleVolatileImage

public abstract VolatileImage createCompatibleVolatileImage(int width,
                                                            int height)
この GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。返された VolatileImage は、元になるグラフィックデバイスに対して最適になるように格納されたデータを持っているので、プラットフォームに固有の描画速度の向上に役立ちます。

パラメータ:
width - 返される VolatileImage の幅
height - 返される VolatileImage の高さ
戻り値:
データレイアウトとカラーモデルがこの GraphicsConfiguration と互換性のある VolatileImage
関連項目:
Component.createVolatileImage(int, int)

createCompatibleVolatileImage

public VolatileImage createCompatibleVolatileImage(int width,
                                                   int height,
                                                   ImageCapabilities caps)
                                            throws AWTException
指定されたイメージ機能を使用して、この GraphicsConfiguration と互換性のあるデータレイアウトとカラーモデルを持つ VolatileImage を返します。返される VolatileImage は、このネイティブのデバイス構成にもっとも近いレイアウトおよびカラーモデルを持っているので、このデバイスに最適に Blit できます。

パラメータ:
width - 返される VolatileImage の幅
height - 返される VolatileImage の高さ
caps - イメージ機能
戻り値:
データレイアウトとカラーモデルがこの GraphicsConfiguration と互換性のある VolatileImage
例外:
AWTException - 指定されたイメージ機能がこのグラフィックス構成に一致しなかった場合
導入されたバージョン:
1.4

createCompatibleImage

public abstract BufferedImage createCompatibleImage(int width,
                                                    int height,
                                                    int transparency)
指定された透明度をサポートし、この GraphicsConfiguration と互換性のあるデータレイアウトおよびカラーモデルを持つ BufferedImage を返します。このメソッドは、デバイスをメモリマッピングすることとは無関係です。返される BufferedImage は、この GraphicsConfiguration を持つデバイスに最適に Blit できるレイアウトおよびカラーモデルを持ちます。

パラメータ:
width - 返される BufferedImage の幅
height - 返される BufferedImage の高さ
transparency - 指定された透明度モード
戻り値:
データレイアウトとカラーモデルがこの GraphicsConfiguration と互換性があり、指定された透明度をサポートする BufferedImage
関連項目:
Transparency.OPAQUE, Transparency.BITMASK, Transparency.TRANSLUCENT

getColorModel

public abstract ColorModel getColorModel()
この GraphicsConfiguration に関連した ColorModel を返します。

戻り値:
この GraphicsConfiguration に関連した ColorModel オブジェクト

getColorModel

public abstract ColorModel getColorModel(int transparency)
指定された透明度をサポートし、この GraphicsConfiguration に関連した ColorModel を返します。

パラメータ:
transparency - 指定された透明度モード
戻り値:
指定された透明度をサポートし、この GraphicsConfiguration に関連した ColorModel オブジェクト

getDefaultTransform

public abstract AffineTransform getDefaultTransform()
この GraphicsConfiguration のデフォルトの AffineTransform を返します。この AffineTransform は通常、最標準の画面に対する恒等変換です。デフォルトの AffineTransform は、72 ユーザ空間座標単位がデバイス空間のおよそ 1 インチに対応するようにデバイスに座標をマッピングします。正規化変換を使用すると、このマッピングをより正確にすることができます。画面デバイスとプリンタデバイスのデフォルトの AffineTransform で定義されている座標空間の座標は、デバイスのターゲット領域の左上隅に原点を持ち、X 座標は右方向に、Y 座標は下方向に値が増加します。createCompatibleImage で作成されない、デバイスに関連していないイメージバッファなどでは、この AffineTransform は恒等変換になります。

戻り値:
この GraphicsConfiguration のデフォルトの AffineTransform

getNormalizingTransform

public abstract AffineTransform getNormalizingTransform()
ユーザ空間の 72 単位がデバイス空間の 1 インチに相当するように、GraphicsConfiguration のデフォルト AffineTransform と連結できる AffineTransform を返します。

特定の Graphics2D では、次の擬似コードを使って変換をリセットし、このようなマッピングを作成できます。

      GraphicsConfiguration gc = g.getGraphicsConfiguration();

      g.setTransform(gc.getDefaultTransform());
      g.transform(gc.getNormalizingTransform());
 
ただし、この AffineTransform は場合によって、たとえばプリンタ出力やメタファイル出力の場合に恒等変換になり、その正確さは元にあるシステムによって指定される情報と同じ程度になります。createCompatibleImage にでは作成されないようなデバイスに関連していないイメージバッファなどでは、有効な距離測定法がないために、この AffineTransform は恒等変換になります。

戻り値:
ユーザ空間の 72 単位がデバイス空間の 1 インチに相当するように、デフォルトの AffineTransform に連結する AffineTransform

getBounds

public abstract Rectangle getBounds()
デバイスの座標の GraphicsConfiguration の境界を返します。仮想デバイスを持つマルチスクリーン環境では、境界は負の X または Y の原点を持つことができます。

戻り値:
この GraphicsConfiguration によってカバーされる領域の境界
導入されたバージョン:
1.3

getBufferCapabilities

public BufferCapabilities getBufferCapabilities()
この GraphicsConfiguration のバッファリング機能を返します。

戻り値:
このグラフィックス構成オブジェクトのバッファリング機能
導入されたバージョン:
1.4

getImageCapabilities

public ImageCapabilities getImageCapabilities()
この GraphicsConfiguration のイメージ機能を返します。

戻り値:
このグラフィックス構成オブジェクトのイメージ機能
導入されたバージョン:
1.4

JavaTM 2
Platform
Std. Ed. v1.4.0

バグの報告と機能のリクエスト
これ以外の API リファレンスおよび開発者用ドキュメントについては、 Java 2 SDK SE 開発者用ドキュメントを参照してください。 開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、 およびコード実例が含まれています。

Java、Java 2D、および JDBC は米国ならびにその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.