public class ComponentColorModel extends ColorModel
ColorModel
クラスの1つで、ピクセル値を扱います。このピクセル値は、色情報およびアルファ情報を個別のサンプルとして表現し、各サンプルを個別のデータ要素に格納します。このクラスは、任意のColorSpace
と一緒に使うことができます。ピクセル値に含まれるカラー・サンプル数は、ColorSpace
の色成分の数と一致する必要があります。アルファ・サンプルは、単一でもかまいません。
transferType
型のプリミティブ配列ピクセル表現を使うメソッドの場合、配列の長さはカラー・サンプルおよびアルファ・サンプルの数と等しくなります。配列にはカラー・サンプルが最初に格納され、アルファ・サンプルがあれば、そのあとに格納されます。カラー・サンプルの順序は、ColorSpace
で指定します。通常、この順序はカラー・スペースの型の名前を反映します。たとえば、TYPE_RGB
の場合、インデックス0は赤、インデックス1は緑、インデックス2は青に対応します。
表示、あるいはイメージ処理のためにピクセル値を色成分またはアルファ成分に変換する処理は、サンプルと成分の1対1対応になります。ComponentColorModel
のインスタンスの作成に使用する転送型に応じて、インスタンスが符号付きか符号なしか、および整数型、float、doubleのいずれか(詳細は以降を参照)によって、ピクセル・サンプル値は表現されます。サンプル値を色成分またはアルファ成分に変換する処理は、特定のルールに従う必要があります。floatおよびdoubleのサンプルの場合は恒等変換で、標準化成分値が対応するサンプル値と等しくなります。整数サンプルの場合は、単純なスケールおよびオフセットのみの変換です。スケール定数とオフセット定数は成分ごとに異なることがあります。スケール定数とオフセット定数を適用した結果は、特定の範囲に確実に収まる色成分およびアルファ成分の値のセットです。通常、色成分の範囲はColorSpace
クラスのgetMinValue
メソッドとgetMaxValue
メソッドによって定義されます。アルファ成分の範囲は0.0 - 1.0です。
転送型DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、およびDataBuffer.TYPE_INT
で作成されたComponentColorModel
のインスタンスは、符号なし整数値として扱われるピクセル・サンプル値を持ちます。ピクセル値の色サンプルとアルファ・サンプルのビット数は、ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)
コンストラクタに渡された、対応するカラー・サンプルおよびアルファ・サンプルのビット数と異なる場合があります。この場合、このクラスは、サンプル値の最下位nビットが成分の値を保持していると見なします。このときnは、コンストラクタに渡された成分の有効ビットの数です。また、より上位にあるサンプル値の任意のビットについては、すべて0であると見なされます。したがって、サンプル値の範囲は0から2n - 1になります。このクラスは、これらのサンプル値を標準化された色成分値にマップするので、各成分について、0はColorSpace
のgetMinValue
メソッドから取得した値にマップされ、2n - 1はgetMaxValue
メソッドから取得した値にマップされます。異なるカラー・サンプルのマッピングのComponentColorModel
lを作成するには、このクラスのサブクラス化し、getNormalizedComponents(Object, float[], int)
メソッドをオーバーライドする必要があります。アルファ・サンプルの場合、常に0が0.0に、2n - 1が1.0にマップされます。
符号なしサンプル値を持つインスタンスでは、次の2つの条件が満たされる場合にのみ、標準化されていない色成分およびアルファ成分表現がサポートされます。1つは、サンプル値0が標準化成分値0.0にマップされ、サンプル値2n - 1が1.0にマップされることです。もう1つは、ColorSpace
のすべての色成分の最小/最大範囲が0.0 - 1.0であることです。この場合、成分表現は対応するサンプルの最下位nビットになります。したがって、各成分は0と2n - 1の間の符号なし整数値です。このときnは、特定の成分の有効ビット数です。これらの条件が満たされない場合は、非標準化成分の引数を取る任意のメソッドがIllegalArgumentException
をスローします。
転送型DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、およびDataBuffer.TYPE_DOUBLE
で作成されたComponentColorModel
のインスタンスは、符号付きshort、float、またはdouble値として扱われるピクセル・サンプル値を保持します。これらのインスタンスは標準化されていない色成分およびアルファ成分表現をサポートしないため、インスタンスを呼び出すと、引数にこれらの表現を取るメソッドはIllegalArgumentException
をスローします。このクラスのインスタンスの標準化成分値は、次の転送型に対応した範囲を持ちます。floatサンプルはfloatデータ型の全範囲、doubleサンプルはfloatデータ型の全範囲(doubleをfloatにキャストした結果)、shortサンプルはほぼ -maxValから+maxValです。maxValはColorSpace
の成分あたりの最大値です(-32767が -maxValに、0が0.0に、32767が+maxValにマップされます)。サブクラスは、getNormalizedComponents(Object, float[], int)
メソッドをオーバーライドすることにより、shortサンプル値の標準化成分値へのスケーリングをオーバーライドすることがあります。floatサンプルとdoubleサンプルについては、標準化成分値が対応するサンプル値と等しくなり、サブクラスはこれらの転送型のどの非恒等変換スケーリングも追加しません。
転送型DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、およびDataBuffer.TYPE_DOUBLE
で作成されたComponentColorModel
のインスタンスは、すべてのサンプル値のすべてのビットを使用します。したがって、すべての色成分およびアルファ成分は、DataBuffer.TYPE_SHORT
の場合は16ビット、DataBuffer.TYPE_FLOAT
の場合は32ビット、DataBuffer.TYPE_DOUBLE
の場合は64ビットを保持します。ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)
形式のコンストラクタがこれらの転送型で使用される場合、ビット配列引数は無視されます。
カラー・サンプル値とアルファ・サンプル値が描画する成分値として適切に解釈されないこともあります。これは、ComponentColorModel
が、符号なしサンプル値の標準化された色成分値へのマッピングをオーバーライドするためサブクラス化されているか、特定の範囲外の符号付きサンプル値が使用されている場合に起こります。たとえば、アルファ成分を0 - 32767の範囲にない符号付きshort値、標準化範囲0.0 - 1.0として指定すると、予期しない結果になります。色成分がColorSpace
の標準化範囲(ColorSpace
クラスのgetMinValue
メソッドとgetMaxValue
メソッドを使用して取得)内にあり、アルファ成分が0.0 - 1.0であるように、描画の前にアプリケーション側でピクセル・データを適切にスケーリングする必要があります。色成分値またはアルファ成分値が範囲外にある場合には、描画結果を確定できません。
ComponentColorModel
の成分数が1でコンポーネント値が符号なし(つまり、転送型DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、またはDataBuffer.TYPE_INT
を使用する単一の色成分のみで、アルファ成分がない)以外の場合、単一のintピクセル表現を使うメソッドはIllegalArgumentException
をスローします。
ComponentColorModel
は、ComponentSampleModel
、BandedSampleModel
、またはPixelInterleavedSampleModel
と組み合わせて、BufferedImage
の作成に使用できます。
pixel_bits, transferType
BITMASK, OPAQUE, TRANSLUCENT
コンストラクタと説明 |
---|
ComponentColorModel(ColorSpace colorSpace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
指定されたパラメータから
ComponentColorModel を構築します。 |
ComponentColorModel(ColorSpace colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
指定されたパラメータから
ComponentColorModel を構築します。 |
修飾子と型 | メソッドと説明 |
---|---|
ColorModel |
coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
ラスター・データが
isAlphaPremultiplied 変数で指定された状態と一致するようにします。このとき、データはこのColorModel によって現在正しく記述されていると見なされます。 |
SampleModel |
createCompatibleSampleModel(int w, int h)
この
ColorModel と互換性のあるデータ・レイアウトを持つ、指定された幅と高さのSampleModel を作成します。 |
WritableRaster |
createCompatibleWritableRaster(int w, int h)
この
ColorModel と互換性のあるデータ・レイアウト(SampleModel )を持つ、指定された幅と高さのWritableRaster を作成します。 |
boolean |
equals(Object obj)
このカラー・モデルと別のカラー・モデルとが等しいかどうかを比較します。
|
int |
getAlpha(int pixel)
指定されたピクセルのアルファ成分を、0 - 255の範囲でスケーリングして返します。
|
int |
getAlpha(Object inData)
指定されたピクセルのアルファ成分を、0 - 255の範囲でスケーリングして返します。
|
WritableRaster |
getAlphaRaster(WritableRaster raster)
イメージのアルファ・チャネルを表現する
Raster を、入力されたRaster から抽出して返します。 |
int |
getBlue(int pixel)
指定されたピクセルの青の色成分を、デフォルトのRGB ColorSpace、つまりsRGBの0 - 255の範囲でスケーリングして返します。
|
int |
getBlue(Object inData)
指定されたピクセルの青の色成分を、デフォルトのRGB
ColorSpace 、つまりsRGBの0 - 255の範囲でスケーリングして返します。 |
int[] |
getComponents(int pixel, int[] components, int offset)
この
ColorModel でピクセルを指定して、標準化されていない色成分とアルファ成分の配列を返します。 |
int[] |
getComponents(Object pixel, int[] components, int offset)
この
ColorModel でピクセルを指定して、標準化されていない色成分とアルファ成分の配列を返します。 |
int |
getDataElement(float[] normComponents, int normOffset)
標準化された色成分およびアルファ成分の配列を指定して、この
ColorModel にint として表されるピクセル値を返します。 |
int |
getDataElement(int[] components, int offset)
指定された、標準化されていない色成分とアルファ成分の配列について、この
ColorModel のintとして表現されるピクセル値を返します。 |
Object |
getDataElements(float[] normComponents, int normOffset, Object obj)
標準化された色成分およびアルファ成分の配列を指定して、この
ColorModel のピクセルのデータ要素配列表現を返します。 |
Object |
getDataElements(int[] components, int offset, Object obj)
標準化されていない色成分およびアルファ成分の配列を指定して、この
ColorModel のピクセルのデータ要素配列表現を返します。 |
Object |
getDataElements(int rgb, Object pixel)
デフォルトRGBカラー・モデルの整数型ピクセル表現を指定して、この
ColorModel のピクセルのデータ要素配列表現を返します。 |
int |
getGreen(int pixel)
指定されたピクセルの緑の色成分を、デフォルトのRGB ColorSpace、つまりsRGBの0 - 255の範囲でスケーリングして返します。
|
int |
getGreen(Object inData)
指定されたピクセルの緑の色成分を、デフォルトのRGB
ColorSpace 、つまりsRGBの0 - 255の範囲でスケーリングして返します。 |
float[] |
getNormalizedComponents(int[] components, int offset, float[] normComponents, int normOffset)
非標準化成分配列を指定して、標準化形式ですべての色成分およびアルファ成分の配列を返します。
|
float[] |
getNormalizedComponents(Object pixel, float[] normComponents, int normOffset)
この
ColorModel の指定されたピクセルについて、標準化形式で色成分とアルファ成分の配列を返します。 |
int |
getRed(int pixel)
指定されたピクセルの赤の色成分を、デフォルトのRGB ColorSpace、つまりsRGBの0 - 255の範囲でスケーリングして返します。
|
int |
getRed(Object inData)
指定されたピクセルの赤の色成分を、デフォルトのRGB ColorSpace、つまりsRGBの0 - 255の範囲でスケーリングして返します。
|
int |
getRGB(int pixel)
ピクセルの色成分とアルファ成分を、デフォルトのRGBカラー・モデル形式で返します。
|
int |
getRGB(Object inData)
指定されたピクセルの色成分およびアルファ成分をデフォルトRGBカラー・モデル形式で返します。
|
int[] |
getUnnormalizedComponents(float[] normComponents, int normOffset, int[] components, int offset)
標準化成分配列を指定して、非標準化形式ですべての色成分およびアルファ成分の配列を返します。
|
boolean |
isCompatibleRaster(Raster raster)
raster がこのColorModel と互換性がある場合にtrueを返し、そうでない場合はfalseを返します。 |
boolean |
isCompatibleSampleModel(SampleModel sm)
指定された
SampleModel がこのColorModel と互換性があるかどうかを判定します。 |
finalize, getColorSpace, getComponentSize, getComponentSize, getNumColorComponents, getNumComponents, getPixelSize, getRGBdefault, getTransferType, getTransparency, hasAlpha, hashCode, isAlphaPremultiplied, toString
public ComponentColorModel(ColorSpace colorSpace, int[] bits, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
ComponentColorModel
を構築します。色成分は、指定されたColorSpace
内になります。サポートされる転送型は、DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、およびDataBuffer.TYPE_DOUBLE
です。nullでない場合、bits
配列は、色成分およびアルファ成分ごとの有効ビット数を指定します。ピクセル値にアルファ情報がない場合、配列の長さは少なくともColorSpace
にある成分数になり、アルファ情報がある場合は、この数よりも1大きくなります。transferType
がDataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、またはDataBuffer.TYPE_DOUBLE
の場合、bits
配列引数は無視されます。hasAlpha
は、アルファ情報の有無を示します。hasAlpha
がtrueの場合、boolean型のisAlphaPremultiplied
は、ピクセル値にあるカラー・サンプルおよびアルファ・サンプルを評価する方法を指定します。booleanがtrueの場合は、カラー・サンプルはアルファ・サンプルと乗算されたと見なされます。transparency
は、このカラー・モデルで表現できるアルファ値を指定します。許容されるtransparency
値はOPAQUE
、BITMASK
、またはTRANSLUCENT
です。transferType
は、ピクセル値の表現に使用するプリミティブ配列の型です。colorSpace
- このカラー・モデルに関連したColorSpace
。bits
- 1成分当たりの有効ビット数。nullの場合、すべての成分サンプルのすべてのビットが有効になる。transferTypeがDataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、またはDataBuffer.TYPE_DOUBLE
の場合は無視され、すべての成分サンプルのすべてのビットが有効になる。hasAlpha
- trueの場合、このカラー・モデルはアルファをサポートする。isAlphaPremultiplied
- trueの場合、アルファはあらかじめ乗算されている。transparency
- このカラー・モデルで表現可能なアルファ値を指定する。transferType
- ピクセル値を表現するために使うプリミティブ配列の型を指定する。IllegalArgumentException
- bits
配列引数がnullでない場合、その長さが色成分およびアルファ成分の数より小さい場合、transferTypeがDataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
のいずれかである場合。IllegalArgumentException
- transferTypeがDataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
のいずれでもない場合。ColorSpace
、Transparency
public ComponentColorModel(ColorSpace colorSpace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType)
ComponentColorModel
を構築します。色成分は、指定されたColorSpace
内になります。サポートされる転送型は、DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、およびDataBuffer.TYPE_DOUBLE
です。色成分およびアルファ成分ごとの有効ビット数は、それぞれ8、16、32、16、32、64です。色成分数はColorSpace
にある成分数になります。hasAlpha
がtrue
の場合、アルファ成分があります。hasAlpha
がtrueの場合、boolean型のisAlphaPremultiplied
は、ピクセル値にあるカラー・サンプルおよびアルファ・サンプルを評価する方法を指定します。booleanがtrueの場合は、カラー・サンプルはアルファ・サンプルと乗算されたと見なされます。transparency
は、このカラー・モデルで表現できるアルファ値を指定します。許容されるtransparency
値はOPAQUE
、BITMASK
、またはTRANSLUCENT
です。transferType
は、ピクセル値の表現に使用するプリミティブ配列の型です。colorSpace
- このカラー・モデルに関連したColorSpace
。hasAlpha
- trueの場合、このカラー・モデルはアルファをサポートする。isAlphaPremultiplied
- trueの場合、アルファはあらかじめ乗算されている。transparency
- このカラー・モデルで表現可能なアルファ値を指定する。transferType
- ピクセル値を表現するために使うプリミティブ配列の型を指定する。IllegalArgumentException
- transferTypeがDataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
のいずれでもない場合。ColorSpace
、Transparency
public int getRed(int pixel)
getRed
、クラス: ColorModel
pixel
- 赤色成分を取得するピクセル。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
の成分値が符号付きの場合public int getGreen(int pixel)
getGreen
、クラス: ColorModel
pixel
- 緑色成分を取得するピクセル。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
の成分値が符号付きの場合public int getBlue(int pixel)
getBlue
、クラス: ColorModel
pixel
- 青色成分を取得するピクセル。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
の成分値が符号付きの場合public int getAlpha(int pixel)
getAlpha
、クラス: ColorModel
pixel
- アルファ成分を取得するピクセル。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
の成分値が符号付きの場合public int getRGB(int pixel)
getRGB
、クラス: ColorModel
pixel
- 色成分またはアルファ成分を取得するピクセル。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
の成分値が符号付きの場合ColorModel.getRGBdefault()
public int getRed(Object inData)
pixel
値は、オブジェクト参照として渡されたtransferType
型のデータ要素からなる配列によって指定されます。戻り値は、あらかじめ乗算されていない値です。アルファがあらかじめ乗算されている場合、このメソッドは値を返す前にアルファを除算します。アルファ値が0の場合、赤の値は0になります。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getRed
、クラス: ColorModel
inData
- 赤色成分を取得するピクセル。transferType
型のデータ要素の配列で指定する。ClassCastException
- inData
がtransferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- inData
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。public int getGreen(Object inData)
ColorSpace
、つまりsRGBの0 - 255の範囲でスケーリングして返します。必要な場合、色変換が行われます。pixel
値は、オブジェクト参照として渡されたtransferType
型のデータ要素からなる配列によって指定されます。戻り値は、あらかじめ乗算されていない値になります。アルファがあらかじめ乗算されている場合、このメソッドは値を返す前にアルファを除算します。アルファ値が0の場合、緑の値は0になります。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getGreen
、クラス: ColorModel
inData
- 緑色成分を取得するピクセル。transferType
型のデータ要素の配列で指定する。ClassCastException
- inData
がtransferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- inData
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。public int getBlue(Object inData)
ColorSpace
、つまりsRGBの0 - 255の範囲でスケーリングして返します。必要な場合、色変換が行われます。pixel
値は、オブジェクト参照として渡されたtransferType
型のデータ要素からなる配列によって指定されます。戻り値は、あらかじめ乗算されていない値になります。アルファがあらかじめ乗算されている場合、このメソッドは値を返す前にアルファを除算します。アルファ値が0の場合、青の値は0になります。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getBlue
、クラス: ColorModel
inData
- 青色成分を取得するピクセル。transferType
型のデータ要素の配列で指定する。ClassCastException
- inData
がtransferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- inData
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。public int getAlpha(Object inData)
transferType
型のデータ要素からなる配列によって指定されます。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getAlpha
、クラス: ColorModel
inData
- アルファ成分を取得するピクセル。transferType
型のデータ要素の配列で指定する。ClassCastException
- inData
がtransferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- inData
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。public int getRGB(Object inData)
transferType
型のデータ要素からなる配列によって指定されます。戻り値は、あらかじめ乗算されていない形式になります。アルファがあらかじめ乗算されていた場合、このメソッドは色成分でアルファを除算します。アルファ値が0の場合、カラー値は0になります。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getRGB
、クラス: ColorModel
inData
- 色成分またはアルファ成分を取得するピクセル。transferType
型のデータ要素の配列で指定する。ClassCastException
- inData
がtransferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- inData
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。ColorModel.getRGBdefault()
public Object getDataElements(int rgb, Object pixel)
ColorModel
のピクセルのデータ要素配列表現を返します。次に、この配列はWritableRaster
オブジェクトのsetDataElements
メソッドに渡すことができます。pixel
パラメータがnullの場合は、新しい配列が割り当てられます。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。getDataElements
、クラス: ColorModel
rgb
- RGBカラー・モデルの整数型ピクセル表現pixel
- 指定されたピクセルColorModel
のピクセルのデータ要素配列表現。ClassCastException
- pixel
がnullでなく、transferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- pixel
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。WritableRaster.setDataElements(int, int, java.lang.Object)
, SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
public int[] getComponents(int pixel, int[] components, int offset)
ColorModel
でピクセルを指定して、標準化されていない色成分とアルファ成分の配列を返します。このColorModel
の成分値が非標準化形式で表現できない場合は、IllegalArgumentExceptionがスローされます。色成分とアルファ成分は、offset
から始まるcomponents
配列に格納されます。これは、配列がこのメソッドで割り当てられても変わりません。getComponents
、クラス: ColorModel
pixel
- 整数で指定されるピクセル値。components
- 標準化されていない色成分またはアルファ成分を格納する整数型の配列。components
配列がnullの場合は、新しい配列が割り当てられる。offset
- components
配列へのオフセット。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このColorModel
が非標準化形式をサポートしない場合ArrayIndexOutOfBoundsException
- components
配列がnullでない場合に、オフセットを起点にすべての色成分およびアルファ成分を格納するのに十分な大きさでない場合。public int[] getComponents(Object pixel, int[] components, int offset)
ColorModel
でピクセルを指定して、標準化されていない色成分とアルファ成分の配列を返します。pixel値は、オブジェクト参照として渡されたtransferType
型のデータ要素からなる配列によって指定されます。このColorModel
の成分値が非標準化形式で表現できない場合は、IllegalArgumentExceptionがスローされます。色成分とアルファ成分は、offset
から始まるcomponents
配列に格納されます。これは、配列がこのメソッドで割り当てられても変わりません。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承しますが、サブクラスがその実装をオーバーライドせず、しかもサポートされていないtransferType
を使用した場合、このメソッドは例外をスローすることがあります。getComponents
、クラス: ColorModel
pixel
- transferType
型のデータ要素の配列で指定されるピクセル値。components
- 標準化されていない色成分またはアルファ成分を格納する整数型の配列。components
配列がnullの場合は、新しい配列が割り当てられる。offset
- components
配列へのオフセット。components
配列。IllegalArgumentException
- このComponentColorModel
が非標準化形式をサポートしない場合UnsupportedOperationException
- このComponentColorModel
の転送型が、DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
の転送型のいずれでもない場合。ClassCastException
- pixel
がtransferType
型のプリミティブ配列でない場合。IllegalArgumentException
- components
配列がnullでなく、オフセットを起点にすべての色成分およびアルファ成分を格納するのに十分な大きさでない場合。またはpixel
がこのColorModelのピクセル値を保持するのに十分な大きさでない場合。public int[] getUnnormalizedComponents(float[] normComponents, int normOffset, int[] components, int offset)
ColorModel
のColorSpace
オブジェクトによって指定された成分ごとの最小と最大の間のfloat値です。このColorModel
の色成分値が非標準化形式で表現できない場合は、IllegalArgumentException
がスローされます。components
の配列がnull
の場合は、新しい配列が割り当てられます。components
配列が返されます。色成分とアルファ成分は、offset
から始まるcomponents
配列に格納されます。これは、配列がこのメソッドで割り当てられても変わりません。components
配列がnull
でない場合に、(offset
を起点に)すべての色成分およびアルファ成分を保持するのに十分な大きさでないときは、ArrayIndexOutOfBoundsException
がスローされます。normComponents
配列がnormOffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合は、IllegalArgumentException
がスローされます。getUnnormalizedComponents
、クラス: ColorModel
normComponents
- 標準化成分を格納している配列normOffset
- 標準化成分の取得を開始する、normComponents
配列へのオフセットcomponents
- normComponents
から成分を受け取る配列offset
- normComponents
から標準化成分の格納を開始する、components
のインデックスIllegalArgumentException
- このComponentColorModel
が非標準化形式をサポートしない場合IllegalArgumentException
- normComponents
の長さマイナスnormOffset
が、numComponents
より小さい場合public float[] getNormalizedComponents(int[] components, int offset, float[] normComponents, int normOffset)
ColorModel
のColorSpace
オブジェクトによって指定された成分ごとの最小と最大の間のfloat値です。このColorModel
の色成分値が非標準化形式で表現できない場合は、IllegalArgumentException
がスローされます。normComponents
の配列がnull
の場合は、新しい配列が割り当てられます。normComponents
配列が返されます。色成分とアルファ成分は、normOffset
から始まるnormComponents
配列に格納されます。これは、配列がこのメソッドで割り当てられても変わりません。normComponents
配列がnull
でない場合に、(normOffset
を起点に)すべての色成分およびアルファ成分を保持するのに十分な大きさでないときは、ArrayIndexOutOfBoundsException
がスローされます。components
配列がoffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合は、IllegalArgumentException
がスローされます。getNormalizedComponents
、クラス: ColorModel
components
- 標準化されていない成分を格納している配列offset
- 標準化されていない成分の取得を開始する、components
配列へのオフセットnormComponents
- 標準化成分を受け取る配列normOffset
- 標準化成分の格納を開始する、normComponents
のインデックスIllegalArgumentException
- このComponentColorModel
が非標準化形式をサポートしない場合public int getDataElement(int[] components, int offset)
ColorModel
のintとして表現されるピクセル値を返します。getDataElement
、クラス: ColorModel
components
- 標準化されていない色成分またはアルファ成分の配列。offset
- components
配列へのオフセット。IllegalArgumentException
- このColorModel
に2つ以上の成分がある場合。IllegalArgumentException
- このComponentColorModel
が非標準化形式をサポートしない場合public Object getDataElements(int[] components, int offset, Object obj)
ColorModel
のピクセルのデータ要素配列表現を返します。次に、この配列はWritableRaster
オブジェクトのsetDataElements
メソッドに渡すことができます。getDataElements
、クラス: ColorModel
components
- 標準化されていない色成分またはアルファ成分の配列。offset
- components
配列内のintオフセット。obj
- ピクセルのデータ要素配列表現を格納するオブジェクト。obj
変数がnullの場合は、新しい配列が割り当てられます。obj
がnullでない場合は、transferType
型のプリミティブ配列でなければなりません。obj
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合は、ArrayIndexOutOfBoundsException
がスローされます。ComponentColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。ColorModel
のピクセルのデータ要素配列表現。IllegalArgumentException
- components配列がオフセットを起点にすべての色成分およびアルファ成分を格納するのに十分な大きさでない場合。ClassCastException
- obj
がnullでなく、transferType
型のプリミティブ配列でない場合。ArrayIndexOutOfBoundsException
- obj
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。IllegalArgumentException
- このComponentColorModel
が非標準化形式をサポートしない場合UnsupportedOperationException
- このComponentColorModel
の転送型が、DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
の転送型のいずれでもない場合。WritableRaster.setDataElements(int, int, java.lang.Object)
, SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
public int getDataElement(float[] normComponents, int normOffset)
ColorModel
にint
として表されるピクセル値を返します。このColorModel
のピクセル値が単一のint
として表現できない場合、このメソッドはIllegalArgumentException
をスローします。normComponents
配列がnormOffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合は、ArrayIndexOutOfBoundsException
がスローされます。getDataElement
、クラス: ColorModel
normComponents
- 標準化された色成分およびアルファ成分の配列normOffset
- 色成分およびアルファ成分の取得を開始する、normComponents
のインデックスColorModel
内のint
ピクセル値。IllegalArgumentException
- このColorModel
のピクセル値が単一のint
として表現できない場合ArrayIndexOutOfBoundsException
- normComponents
配列がnormOffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合public Object getDataElements(float[] normComponents, int normOffset, Object obj)
ColorModel
のピクセルのデータ要素配列表現を返します。次に、この配列はWritableRaster
オブジェクトのsetDataElements
メソッドに渡すことができます。normComponents
配列がnormOffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合は、ArrayIndexOutOfBoundsException
がスローされます。obj
変数がnull
の場合は、新しい配列が割り当てられます。obj
がnull
でない場合、transferType型のプリミティブ配列でなければならず、そうでない場合はClassCastException
がスローされます。obj
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合は、ArrayIndexOutOfBoundsException
がスローされます。getDataElements
、クラス: ColorModel
normComponents
- 標準化された色成分およびアルファ成分の配列normOffset
- 色成分およびアルファ成分の取得を開始する、normComponents
のインデックスobj
- 返されたピクセルを保持するプリミティブ・データ配列Object
ClassCastException
- obj
がtransferType
型のプリミティブ配列でない場合ArrayIndexOutOfBoundsException
- obj
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合、あるいはnormComponents
配列が、normOffset
を開始点にして、すべての色成分およびアルファ成分を保持するのに十分な大きさでない場合WritableRaster.setDataElements(int, int, java.lang.Object)
, SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
public float[] getNormalizedComponents(Object pixel, float[] normComponents, int normOffset)
ColorModel
の指定されたピクセルについて、標準化形式で色成分とアルファ成分の配列を返します。pixel値は、オブジェクト参照として渡されたtransferType型のデータ要素からなる配列によって指定されます。pixelがtransferType型のプリミティブ配列でない場合は、ClassCastException
がスローされます。pixel
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合は、ArrayIndexOutOfBoundsException
がスローされます。標準化成分は、このColorModel
のColorSpace
オブジェクトによって指定された成分ごとの最小と最大の間のfloat値です。normComponents
の配列がnull
の場合は、新しい配列が割り当てられます。normComponents
配列が返されます。色成分とアルファ成分は、normOffset
から始まるnormComponents
配列に格納されます。これは、配列がこのメソッドで割り当てられても変わりません。normComponents
配列がnull
でない場合に、(normOffset
を起点に)すべての色成分およびアルファ成分を保持するのに十分な大きさでないときは、ArrayIndexOutOfBoundsException
がスローされます。
サブクラスがデフォルトとは異なる方法でピクセル・サンプル値を色成分値へ変換するよう設計されている場合は、このメソッドをサブクラスでオーバーライドする必要があります。このクラスにより実装されるデフォルトの変換は、クラスのコメントに記述されています。デフォルトではない変換を実装するサブクラスは、このコメントに定義された許容変換の制約に従う必要があります。
getNormalizedComponents
、クラス: ColorModel
pixel
- 指定されたピクセルnormComponents
- 標準化成分を受け取る配列normOffset
- 標準化成分の格納を開始する、normComponents
配列へのオフセットClassCastException
- pixel
がtransferType型のプリミティブ配列でない場合ArrayIndexOutOfBoundsException
- normComponents
がnormOffset
を起点にすべての色成分とアルファ成分を保持するのに十分な大きさでない場合ArrayIndexOutOfBoundsException
- pixel
がこのColorModel
のピクセル値を保持するのに十分な大きさでない場合。public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
isAlphaPremultiplied
変数で指定された状態と一致するようにします。このとき、データはこのColorModel
によって現在正しく記述されていると見なされます。このメソッドは、カラー・ラスター・データをアルファで乗算または除算します。データが正しい状態にある場合には、処理は行いません。データが強制的に型変換される必要がある場合、このメソッドはisAlphaPremultiplied
フラグを正しく設定した、このColorModel
のインスタンスも返します。ColorModel
はサブクラス化できるため、サブクラスはこのメソッドの実装を継承します。サブクラスがオーバーライドしない場合、サポートされていないtransferType
を使用した場合は例外をスローします。coerceData
、クラス: ColorModel
raster
- WritableRaster
データisAlphaPremultiplied
- アルファがあらかじめ乗算されている場合はtrue
、そうでない場合はfalse
ColorModel
オブジェクト。NullPointerException
- raster
がnull
で、強制変換が必要な場合。UnsupportedOperationException
- このComponentColorModel
の転送型が、サポートされている転送型(DataBuffer.TYPE_BYTE
、DataBuffer.TYPE_USHORT
、DataBuffer.TYPE_INT
、DataBuffer.TYPE_SHORT
、DataBuffer.TYPE_FLOAT
、DataBuffer.TYPE_DOUBLE
)でない場合。public boolean isCompatibleRaster(Raster raster)
raster
がこのColorModel
と互換性がある場合にtrueを返し、そうでない場合はfalseを返します。isCompatibleRaster
、クラス: ColorModel
raster
- 互換性を判定するRaster
オブジェクト。raster
がこのColorModel
と互換性がある場合はtrue
、そうでない場合はfalse
。public WritableRaster createCompatibleWritableRaster(int w, int h)
ColorModel
と互換性のあるデータ・レイアウト(SampleModel
)を持つ、指定された幅と高さのWritableRaster
を作成します。createCompatibleWritableRaster
、クラス: ColorModel
w
- 生成するWritableRaster
の幅。h
- 生成するWritableRaster
の高さ。ColorModel
と互換性のあるWritableRaster
。WritableRaster
、SampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
ColorModel
と互換性のあるデータ・レイアウトを持つ、指定された幅と高さのSampleModel
を作成します。createCompatibleSampleModel
、クラス: ColorModel
w
- 生成するSampleModel
の幅。h
- 生成するSampleModel
の高さ。ColorModel
と互換性のあるSampleModel
。SampleModel
public boolean isCompatibleSampleModel(SampleModel sm)
SampleModel
がこのColorModel
と互換性があるかどうかを判定します。isCompatibleSampleModel
、クラス: ColorModel
sm
- 互換性を判定するSampleModel
。SampleModel
がこのColorModel
と互換性がある場合はtrue
、そうでない場合はfalse
。SampleModel
public WritableRaster getAlphaRaster(WritableRaster raster)
Raster
を、入力されたRaster
から抽出して返します。このメソッドは、このColorModel
に関連したRaster
オブジェクトにアルファ・バンドがあれば、そのアルファ・バンドをイメージ・データの最終バンドとして格納していると見なします。このColorModel
に関連した空間アルファ・チャネルがほかにない場合は、nullを返します。このメソッドは新しいRaster
を作成しますが、データ配列は共有することになります。getAlphaRaster
、クラス: ColorModel
raster
- アルファ・チャネルを抽出するWritableRaster
。WritableRaster
。public boolean equals(Object obj)
equals
、クラス: ColorModel
obj
- このカラー・モデルと比較するオブジェクト。true
、そうでない場合はfalse
。Object.hashCode()
、HashMap
バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2016, Oracle and/or its affiliates. All rights reserved.Use is subject to license termsDocumentation Redistribution Policyも参照してください。