- java.lang.Object
-
- java.awt.GraphicsConfiguration
-
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
-
-
コンストラクタのサマリー
コンストラクタ 修飾子 コンストラクタ 説明 protectedGraphicsConfiguration()これは、インスタンスを直接には生成できない抽象クラスです。
-
メソッドのサマリー
すべてのメソッド インスタンス・メソッド 抽象メソッド 具象メソッド 修飾子と型 メソッド 説明 BufferedImagecreateCompatibleImage(int width, int height)このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つBufferedImageを返します。BufferedImagecreateCompatibleImage(int width, int height, int transparency)指定された透明度をサポートし、このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つBufferedImageを返します。VolatileImagecreateCompatibleVolatileImage(int width, int height)このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。VolatileImagecreateCompatibleVolatileImage(int width, int height, int transparency)このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。VolatileImagecreateCompatibleVolatileImage(int width, int height, ImageCapabilities caps)指定されたイメージ機能を使用して、このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。VolatileImagecreateCompatibleVolatileImage(int width, int height, ImageCapabilities caps, int transparency)指定されたイメージ機能と透明度の値を使用して、このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。abstract RectanglegetBounds()デバイス座標内のGraphicsConfigurationの境界を返します。BufferCapabilitiesgetBufferCapabilities()このGraphicsConfigurationのバッファリング機能を返します。abstract ColorModelgetColorModel()このGraphicsConfigurationに関連付けられたColorModelを返します。abstract ColorModelgetColorModel(int transparency)指定された透明度をサポートする、このGraphicsConfigurationに関連付けられたColorModelを返します。abstract AffineTransformgetDefaultTransform()このGraphicsConfigurationのデフォルトのAffineTransformを返します。abstract GraphicsDevicegetDevice()このGraphicsConfigurationに関連付けられたGraphicsDeviceを返します。ImageCapabilitiesgetImageCapabilities()このGraphicsConfigurationのイメージ機能を返します。abstract AffineTransformgetNormalizingTransform()GraphicsConfigurationのデフォルトのAffineTransformと連結できるAffineTransformを返します。これにより、ユーザー空間の72単位がデバイス空間の1インチに等しくなります。booleanisTranslucencyCapable()このGraphicsConfigurationが半透明性の種類PERPIXEL_TRANSLUCENTをサポートしているかどうかを返します。
-
-
-
メソッドの詳細
-
getDevice
public abstract GraphicsDevice getDevice()
このGraphicsConfigurationに関連付けられたGraphicsDeviceを返します。- 戻り値:
- この
GraphicsConfigurationに関連付けられたGraphicsDeviceオブジェクト。
-
createCompatibleImage
public BufferedImage createCompatibleImage(int width, int height)
このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つBufferedImageを返します。 このメソッドは、デバイスをメモリー・マッピングすることとは無関係です。 返されたBufferedImageは、このネイティブなデバイス構成にもっとも近いレイアウトとカラー・モデルを持っているため、このデバイスに最適にブリットできます。- パラメータ:
width- 返された次の幅:BufferedImageheight- 返された次の高さ:BufferedImage- 戻り値:
- データ・レイアウトとカラー・モデルがこの
GraphicsConfigurationと互換性のあるBufferedImage。
-
createCompatibleImage
public BufferedImage createCompatibleImage(int width, int height, int transparency)
指定された透明度をサポートし、このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つBufferedImageを返します。 このメソッドは、デバイスをメモリー・マッピングすることとは無関係です。 返されるBufferedImageは、このGraphicsConfigurationを持つデバイスに最適にブリットできるレイアウトおよびカラー・モデルを持ちます。- パラメータ:
width- 返された次の幅:BufferedImageheight- 返された次の高さ:BufferedImagetransparency- 指定された透明度モード- 戻り値:
- データ・レイアウトとカラー・モデルがこの
GraphicsConfigurationと互換性があり、指定された透明度をサポートするBufferedImage。 - 例外:
IllegalArgumentException- 透明度が有効な値でない場合- 関連項目:
Transparency.OPAQUE,Transparency.BITMASK,Transparency.TRANSLUCENT
-
createCompatibleVolatileImage
public VolatileImage createCompatibleVolatileImage(int width, int height)
このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。 返されたVolatileImageには、基本となるグラフィックス・デバイスのために最適に格納されたデータが含まれている可能性があるため、プラットフォーム固有の描画の高速化の利点が得られる可能性があります。- パラメータ:
width- 返された次の幅:VolatileImageheight- 返された次の高さ:VolatileImage- 戻り値:
- データ・レイアウトとカラー・モデルがこの
GraphicsConfigurationと互換性のあるVolatileImage。 - 導入されたバージョン:
- 1.4
- 関連項目:
Component.createVolatileImage(int, int)
-
createCompatibleVolatileImage
public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency)
このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。 返されたVolatileImageには、基本となるグラフィックス・デバイスのために最適に格納されたデータが含まれている可能性があるため、プラットフォーム固有の描画の高速化の利点が得られる可能性があります。- パラメータ:
width- 返された次の幅:VolatileImageheight- 返された次の高さ:VolatileImagetransparency- 指定された透明度モード- 戻り値:
- データ・レイアウトとカラー・モデルがこの
GraphicsConfigurationと互換性のあるVolatileImage。 - 例外:
IllegalArgumentException- 透明度が有効な値でない場合- 導入されたバージョン:
- 1.5
- 関連項目:
Transparency.OPAQUE,Transparency.BITMASK,Transparency.TRANSLUCENT,Component.createVolatileImage(int, int)
-
createCompatibleVolatileImage
public VolatileImage createCompatibleVolatileImage(int width, int height, ImageCapabilities caps) throws AWTException
指定されたイメージ機能を使用して、このGraphicsConfigurationと互換性のあるデータ・レイアウトとカラー・モデルを持つVolatileImageを返します。capsパラメータがnullである場合は、このパラメータが事実上無視され、このメソッドはImageCapabilities制約には関係なくVolatileImageを作成します。 返されたVolatileImageは、このネイティブなデバイス構成にもっとも近いレイアウトとカラー・モデルを持っているため、このデバイスに最適にブリットできます。- パラメータ:
width- 返された次の幅:VolatileImageheight- 返された次の高さ:VolatileImagecaps- イメージ機能- 戻り値:
- データ・レイアウトとカラー・モデルがこの
GraphicsConfigurationと互換性のあるVolatileImage。 - 例外:
AWTException- 指定されたイメージ機能をこのグラフィックス構成が満足できなかった場合- 導入されたバージョン:
- 1.4
-
createCompatibleVolatileImage
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- 指定されたイメージ機能をこのグラフィックス構成が満足できなかった場合- 導入されたバージョン:
- 1.5
- 関連項目:
Transparency.OPAQUE,Transparency.BITMASK,Transparency.TRANSLUCENT,Component.createVolatileImage(int, int)
-
getColorModel
public abstract ColorModel getColorModel()
このGraphicsConfigurationに関連付けられたColorModelを返します。- 戻り値:
- この
GraphicsConfigurationに関連付けられたColorModelオブジェクト。
-
getColorModel
public abstract ColorModel getColorModel(int transparency)
指定された透明度をサポートする、このGraphicsConfigurationに関連付けられたColorModelを返します。- パラメータ:
transparency- 指定された透明度モード- 戻り値:
- この
GraphicsConfigurationに関連し、指定された透明度をサポートするColorModelオブジェクト。透明度が有効な値でない場合はnull。 - 関連項目:
Transparency.OPAQUE,Transparency.BITMASK,Transparency.TRANSLUCENT
-
getDefaultTransform
public abstract AffineTransform getDefaultTransform()
このGraphicsConfigurationのデフォルトのAffineTransformを返します。 このAffineTransformは通常、ほとんどの標準画面では恒等変換になります。 デフォルトのAffineTransformは、72ユーザー空間座標単位がデバイス空間のおよそ1インチに対応するようにデバイスに座標をマッピングします。 正規化変換を使用すると、このマッピングをより正確にすることができます。 画面デバイスとプリンタ・デバイスのデフォルトのAffineTransformで定義されている座標空間の座標は、デバイスのターゲット領域の左上隅に原点を持ち、X座標は右方向に、Y座標は下方向に値が増加します。createCompatibleImageで作成されない、デバイスに関連していないイメージ・バッファなどでは、このAffineTransformは恒等変換になります。- 戻り値:
- この
GraphicsConfigurationのデフォルトのAffineTransform。
-
getNormalizingTransform
public abstract AffineTransform getNormalizingTransform()
GraphicsConfigurationのデフォルトのAffineTransformと連結できるAffineTransformを返します。これにより、ユーザー空間の72単位がデバイス空間の1インチに等しくなります。gという特定の
Graphics2Dでは、次の擬似コードを使って変換をリセットし、このようなマッピングを作成できます。GraphicsConfiguration gc = g.getDeviceConfiguration(); g.setTransform(gc.getDefaultTransform()); g.transform(gc.getNormalizingTransform());ただし、このAffineTransformは場合によって、たとえばプリンタ出力やメタファイル出力の場合に恒等変換になり、この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
-
isTranslucencyCapable
public boolean isTranslucencyCapable()
このGraphicsConfigurationが半透明性の種類PERPIXEL_TRANSLUCENTをサポートしているかどうかを返します。- 戻り値:
- 指定されたGraphicsConfigurationが半透明性効果をサポートしているかどうか。
- 導入されたバージョン:
- 1.7
- 関連項目:
Window.setBackground(Color)
-
-