|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
java.lang.Objectjava.awt.image.ColorModel
java.awt.image.ComponentColorModel
public class ComponentColorModel
ʹ������ֵ����ɫ�� alpha ��Ϣ��ʾΪ���������� ColorModel
�࣬�����Զ���������Ԫ�ش洢ÿ��������������������� ColorSpace
һ��ʹ�á�����ֵ�е���ɫ������������ ColorSpace
�е���ɫ��������ͬ�������е��� alpha ������
������Щʹ�� transferType
���͵Ļ����������ر�ʾ��ʽ�ķ���������ij�������ɫ�� alpha ��������ͬ����ɫ�����洢�ں�� alpha ������������ڣ��������ǰ�档��ɫ������˳���� ColorSpace
ָ����ͨ������˳��ӳ��ɫ�ռ����͵����ơ����磬���� TYPE_RGB
������ 0 ��Ӧ�ں�ɫ������ 1 ��Ӧ����ɫ������ 2 ��Ӧ����ɫ��
������ʾ����Ŀ�Ķ�ִ�е�����ֵ����ɫ/alpha ������ת���ǻ��ڴ�������������һһ��Ӧ��ϵ���еġ���ʵ����ʾ����������ֵ�������з��ŵĻ����ŵģ�Ҳ���������ͻ��� float �� double ���ͣ��й�ϸ����μ��������ݣ�������ȡ������������ ComponentColorModel
ʵ���Ĵ������͡�������ֵ��������ɫ/alpha ������ת��������ѭһ���Ĺ����� float �� double ������ת��Ϊһ�ֱ�ʶ������������ֵ������Ӧ������ֵ����������������ת��Ӧ��ֻ�Ǽ����ź�ƫ�ƣ�����ÿ�����������ź�ƫ�Ƴ�������������ͬ��Ӧ�����ź�ƫ�Ƴ����Ľ�����γ�һ����ɫ/alpha ����ֵ���������Ա�֤��Щֵ�䵽һ����Χ�ڡ�ͨ������ɫ�����ķ�Χ��Ϊ�� ColorSpace
��� getMinValue
�� getMaxValue
��������ķ�Χ��alpha �����ķ�ΧӦΪ�� 0.0 �� 1.0��
������ DataBuffer.TYPE_BYTE
��DataBuffer.TYPE_USHORT
�� DataBuffer.TYPE_INT
������ ComponentColorModel
��ʵ�����б���Ϊ��������ֵ����������ֵ������ֵ����ɫ�� alpha �����е�λ�����ܲ�ͬ�ڴ��ݵ� ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)
���췽������Ӧ��ɫ�� alpha ������λ��������������£�����ٶ�����ֵ�� n λ�����Чλ�������ֵ������ n Ϊ���ݵ����췽���ķ�������Чλ���������ٶ�����ֵ�����нϸ�λ��Ϊ�㡣��ˣ�����ֵ�ķ�ΧΪ 0 �� 2n - 1�����ཫ��Щ����ֵӳ�䵽������ɫ����ֵ����ʹ 0 ӳ�䵽��ÿ�������� ColorSpace
�� getMinValue
�����õ���ֵ��2n - 1 ӳ�䵽�� getMaxValue
�õ���ֵ���������в�ͬ��ɫ����ӳ��� ComponentColorModel
��Ҫ������࣬����д getNormalizedComponents(Object, float[], int)
������alpha ������ӳ��ʼ�ս� 0 ӳ�䵽 0.0���� 2n - 1 ӳ�䵽 1.0��
���ڴ�����������ֵ��ʵ�������������������߱�ʱ���DZ�������ɫ/alpha ������ʾ��ʽ����֧�֡����ȣ�����ֵ 0 ����ӳ�䵽��������ֵ 0.0������ֵ 2n - 1 ӳ�䵽 1.0����Σ�ColorSpace
��������ɫ��������Сֵ/���ȡֵ��Χ����Ϊ 0.0 �� 1.0 ֮�䡣����������£�������ʾ��ʽΪ��Ӧ������ n λ�����Чλ����ˣ�ÿ��������Ϊ���� 0 �� 2n - 1 ֮�����������ֵ������ n Ϊ�ض���������Чλ�������δ������Щ����������÷DZ��������������κη��������׳� IllegalArgumentException
��
������ DataBuffer.TYPE_SHORT
��DataBuffer.TYPE_FLOAT
�� DataBuffer.TYPE_DOUBLE
������ ComponentColorModel
��ʵ�����б���Ϊ�з��ŵ� short��float �� double ֵ����������ֵ������ʵ����֧�ַDZ�������ɫ/alpha ������ʾ��ʽ����˽������ʾ��ʽ������������Щʵ��������֮һ�ϵ����κη��������׳� 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 ��������������ֵ����Ϊ������Ӧ������ֵ�����Ӧ��ͼ������Щ�������͵��κηDZ�ʶ���š�
������ DataBuffer.TYPE_SHORT
��DataBuffer.TYPE_FLOAT
�� DataBuffer.TYPE_DOUBLE
������ ComponentColorModel
��ʵ��ʹ����������ֵ������λ����ˣ�ʹ�� DataBuffer.TYPE_SHORT
ʱ������ɫ/alpha �������� 16 λ��ʹ�� DataBuffer.TYPE_FLOAT
ʱ���� 32��ʹ�� DataBuffer.TYPE_DOUBLE
ʱ���� 64 λ�������췽���� ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)
��ʽ����Щ��������֮һһ��ʹ��ʱ��λ��������������ԡ�
���ܽ����ܺ������͵���ɫ/alpha ����ֵ��Ϊ���ڳ��ֵķ���ֵ������� ComponentColorModel
����д��������ֵ��������ɫ����ֵ��ӳ��ʱ����ʹ��ijһ��Χ֮����з�������ֵʱ����������ܷ����������磬�� alpha ����ָ��Ϊ��Χ 0 �� 32767����������Χ 0.0 �� 1.0��֮����з��� short ֵ���ܵ��²���Ԥ�ϵĽ������Ӧ�ó������ڳ���֮ǰ�ʵ������������ݣ���ʹ��ɫ�������� ColorSpace
��ʹ�� ColorSpace
��� getMinValue
�� getMaxValue
�����õ����ı�����Χ�ڣ���ʹ alpha ����λ�� 0.0 �� 1.0 ֮�䡣�����ɫ�� alpha ����ֵ������Щ��Χ������ֽ���Dz�ȷ���ġ�
ʹ�õ��� int ���ر�ʾ��ʽ�ķ����׳� IllegalArgumentException
������ ComponentColorModel
�ķ�����Ϊ 1 �ҷ���ֵ���ţ���ʹ�� DataBuffer.TYPE_BYTE
��DataBuffer.TYPE_USHORT
�� DataBuffer.TYPE_INT
�Ĵ������͵ĵ�����ɫ������û�� alpha ������
ComponentColorModel
������ ComponentSampleModel
��BandedSampleModel
�� PixelInterleavedSampleModel
һ��ʹ�ã��Թ��� BufferedImage
��
ColorModel
,
ColorSpace
,
ComponentSampleModel
,
BandedSampleModel
,
PixelInterleavedSampleModel
,
BufferedImage
�ֶ�ժҪ |
---|
���� java.awt.image.ColorModel �̳е��ֶ� |
---|
pixel_bits, transferType |
�ӽӿ� java.awt.Transparency �̳е��ֶ� |
---|
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)
��ָ�����Ⱥ߶ȴ����� SampleModel ��������� ColorModel ���ݵ����ݲ��֡� |
WritableRaster |
createCompatibleWritableRaster(int w,
int h)
��ָ�����Ⱥ߶ȴ����� WritableRaster ��������� ColorModel ���ݵ����ݲ��� (SampleModel )�� |
boolean |
equals(Object obj)
������ɫģ��������ģ�ͽ�������ԱȽϡ� |
int |
getAlpha(int pixel)
����ָ�����أ����ŷ�Χ�� 0 �� 255���� alpha ������ |
int |
getAlpha(Object inData)
����ָ�����أ��� 0 �� 255 ֮�����ţ��� alpha ������ |
WritableRaster |
getAlphaRaster(WritableRaster raster)
���ر�ʾijͼ������ Raster ��ȡ���� alpha ͨ���� 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 ���Ѹ������صķDZ�����ɫ/alpha ������ |
int[] |
getComponents(Object pixel,
int[] components,
int offset)
�����ڴ� ColorModel ���Ѹ������صķDZ�����ɫ/alpha ���������顣 |
int |
getDataElement(float[] normComponents,
int normOffset)
���Ѹ���������ɫ/alpha ���������������£������� int ���ͱ�ʾ�ڴ� ColorModel �е�����ֵ�� |
int |
getDataElement(int[] components,
int offset)
������ ColorModel �б�ʾΪ int ������ֵ���Ѹ����DZ�����ɫ/alpha ���������飩�� |
Object |
getDataElements(float[] normComponents,
int normOffset,
Object obj)
���Ѹ���������ɫ/alpha ���������������£����ش� ColorModel �����ص�����Ԫ�������ʾ��ʽ�� |
Object |
getDataElements(int[] components,
int offset,
Object obj)
���Ѹ����DZ�����ɫ/alpha ����������£����ش� 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)
�ڸ��������������������£������Ա�����ʽ���ڵ�������ɫ/alpha ���������顣 |
float[] |
getNormalizedComponents(Object pixel,
float[] normComponents,
int normOffset)
�������� ColorModel �и��������صı�����ʽ��ɫ/alpha ���������顣 |
int |
getRed(int pixel)
����ָ�����صĺ�ɫ������ָ��������Ĭ�ϵ� RGB ColorSpace���� sRGB�������ŷ�Χ�� 0 �� 255�� |
int |
getRed(Object inData)
����ָ�����صĺ�ɫ������ָ��������Ĭ�ϵ� RGB ColorSpace���� sRGB�������ŷ�Χ�� 0 �� 255�� |
int |
getRGB(int pixel)
����Ĭ�ϵ� RGB ��ɫģ��ʽ�����ص���ɫ/alpha ������ |
int |
getRGB(Object inData)
����Ĭ�ϵ� RGB ��ɫģ��ʽ�е����ص���ɫ/alpha ������ |
int[] |
getUnnormalizedComponents(float[] normComponents,
int normOffset,
int[] components,
int offset)
���Ѹ��������������������£������ԷDZ�����ʽ���ڵ�������ɫ/alpha ���������顣 |
boolean |
isCompatibleRaster(Raster raster)
��� raster ��� ColorModel ���ݣ��� true����������ݣ��� false�� |
boolean |
isCompatibleSampleModel(SampleModel sm)
���ָ�� SampleModel �Ƿ���� ColorModel ���ݡ� |
���� java.awt.image.ColorModel �̳еķ��� |
---|
finalize, getColorSpace, getComponentSize, getComponentSize, getNumColorComponents, getNumComponents, getPixelSize, getRGBdefault, getTransferType, getTransparency, hasAlpha, hashCode, isAlphaPremultiplied, toString |
���� java.lang.Object �̳еķ��� |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
���췽����ϸ��Ϣ |
---|
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
����ָ��ÿ����ɫ�� alpha ��������Чλ���������������ֵ�в����� alpha ��Ϣ�����䳤������Ӧ���� ColorSpace
�з�������������� alpha ��Ϣ�����䳤�ȴ��ڴ������� transferType
Ϊ DataBuffer.TYPE_SHORT
��DataBuffer.TYPE_FLOAT
�� DataBuffer.TYPE_DOUBLE
ʱ������ bits
���������hasAlpha
ָʾ�Ƿ���� alpha ��Ϣ����� hasAlpha
Ϊ true����ֵ isAlphaPremultiplied
ָ����ν�������ֵ�е���ɫ�� alpha �������������ֵΪ true����ٶ���ɫ�������� alpha ������ˡ�transparency
ָ�������ɴ���ɫģ�ͱ�ʾ�� alpha ֵ�����Խ��ܵ� transparency
ֵΪ OPAQUE
��BITMASK
�� TRANSLUCENT
��transferType
�����ڱ�ʾ����ֵ�Ļ�����������͡�
colorSpace
- �����ɫģ������ ColorSpace
��bits
- ÿ����������Чλ��������Ϊ null������������£����з�������������λ������Ч����� transferType Ϊ DataBuffer.TYPE_SHORT
��DataBuffer.TYPE_FLOAT
�� DataBuffer.TYPE_DOUBLE
֮һ������ԣ�����������£����з�������������λ������Ч��hasAlpha
- ���Ϊ true�������ɫģ��֧�� alpha��isAlphaPremultiplied
- ���Ϊ true���� alpha Ԥ�˵ġ�transparency
- ָ�������ɴ���ɫģ�ͱ�ʾ�� alpha ֵ��transferType
- ָ�����ڱ�ʾ����ֵ�Ļ�����������͡�
IllegalArgumentException
- ��� bits
���������Ϊ null�����䳤��С����ɫ�� alpha ���������� 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
��ÿ����ɫ�� alpha ��������Чλ�����ֱ�Ϊ 8��16��32��16��32 �� 64����ɫ������Ϊ ColorSpace
�еķ���������� hasAlpha
Ϊ true
������� alpha ��������� hasAlpha
Ϊ true����ֵ isAlphaPremultiplied
ָ����ν�������ֵ�е���ɫ�� alpha �������������ֵΪ true����ٶ���ɫ�������� alpha ������ˡ�transparency
ָ�������ɴ���ɫģ�ͱ�ʾ�� alpha ֵ�����Խ��ܵ� transparency
ֵΪ OPAQUE
��BITMASK
�� TRANSLUCENT
��transferType
�����ڱ�ʾ����ֵ�Ļ�����������͡�
colorSpace
- �����ɫģ������ ColorSpace
��hasAlpha
- ���Ϊ true�������ɫģ��֧�� alpha��isAlphaPremultiplied
- ���Ϊ true���� alpha Ԥ�˵ġ�transparency
- ָ�������ɴ���ɫģ�ͱ�ʾ�� alpha ֵ��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)
ColorModel
�е� getRed
pixel
- Ҫ���л�ȡ��ɫ���������ء�
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
�ķ���ֵΪ�з��ŵġ�public int getGreen(int pixel)
ColorModel
�е� getGreen
pixel
- Ҫ���л�ȡ��ɫ���������ء�
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
�ķ���ֵΪ�з��ŵġ�public int getBlue(int pixel)
ColorModel
�е� getBlue
pixel
- Ҫ���л�ȡ��ɫ���������ء�
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
�ķ���ֵΪ�з��ŵġ�public int getAlpha(int pixel)
ColorModel
�е� getAlpha
pixel
- Ҫ���л�ȡ alpha ���������ء�
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
�ķ���ֵΪ�з��ŵġ�public int getRGB(int pixel)
ColorModel
�е� getRGB
pixel
- Ҫ���л�ȡ��ɫ/alpha ���������ء�
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
�ķ���ֵΪ�з��ŵġ�ColorModel.getRGBdefault()
public int getRed(Object inData)
pixel
ֵ����Ϊ�������ö���������� transferType
������Ԫ�ص�����ָ�������ص�ֵΪ��Ԥ�ȳ˵õ�ֵ������� alpha Ԥ����ˣ��˷������ڷ���ֵ����� alpha ֵΪ 0�����ɫֵ��Ϊ 0��֮ǰ�������������Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�е� getRed
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
������Ԫ�ص�����ָ�������ص�ֵ��һ����Ԥ�ȳ˵õ�ֵ������� alpha Ԥ����ˣ��˷������ڷ���ֵ����� alpha ֵΪ 0������ɫֵ��Ϊ 0��֮ǰ�������������Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�е� getGreen
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
������Ԫ�ص�����ָ�������ص�ֵ��һ����Ԥ�ȳ˵õ�ֵ������� alpha Ԥ����ˣ��˷������ڷ���ֵ����� alpha ֵΪ 0������ɫֵ��Ϊ 0��֮ǰ�������������Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�е� getBlue
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
ʱ�����׳��쳣��
ColorModel
�е� getAlpha
inData
- Ҫ���л�ȡ alpha ������������ 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
���͵�����Ԫ������ָ�������ص�ֵ�Ƿ�Ԥ�˸�ʽ������� alpha Ԥ����ˣ��˷����Ὣ�����ɫ��������� alpha ֵΪ 0������ɫֵΪ 0���г���������Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�е� getRGB
inData
- Ҫ���л�ȡ��ɫ/alpha ������������ 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
ʱ�����׳��쳣��
ColorModel
�е� getDataElements
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
���Ѹ������صķDZ�����ɫ/alpha ����������� ColorModel
�ķ���ֵ�������ԷDZ�����ʽ��ʾ���� IllegalArgumentException������ɫ/alpha �����洢���� offset
��ͷ�� components
�����У�����˷����ѷ���������Ҳ����ˡ�
ColorModel
�е� getComponents
pixel
- ָ��Ϊ����������ֵ��components
- �����д洢�DZ�����ɫ/alpha �������������顣��� components
����Ϊ null������������顣offset
- components
�����ƫ������
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ColorModel
��֧�ַDZ�����ʽ
ArrayIndexOutOfBoundsException
- ��� components
���鲻Ϊ null �Ҳ����ر���ܱ���������ɫ�� alpha ��������ƫ������ͷ����public int[] getComponents(Object pixel, int[] components, int offset)
ColorModel
���Ѹ������صķDZ�����ɫ/alpha ���������顣����ֵ����Ϊһ���������ö������ transferType
���͵�����Ԫ������ָ��������� ColorModel
�ķ���ֵ�������ԷDZ�����ʽ��ʾ���� IllegalArgumentException������ɫ/alpha �����洢���� offset
��ͷ�� components
�����У�����˷����ѷ���������Ҳ����ˡ���Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�˷��������׳��쳣��
ColorModel
�е� getComponents
pixel
- ������ transferType
������Ԫ�ص�����ָ��������ֵ��components
- �����д洢�DZ�����ɫ/alpha �������������顣��� components
����Ϊ null������������顣offset
- components
�����ƫ������
components
���顣
IllegalArgumentException
- ����� ComponentColorModel
��֧�ַDZ�����ʽ
UnsupportedOperationException
- ��ijЩ����£������ ComponentColorModel
�Ĵ������Ͳ�Ϊ���´�������֮һ��DataBuffer.TYPE_BYTE
��DataBuffer.TYPE_USHORT
�� DataBuffer.TYPE_INT
��
ClassCastException
- ��� pixel
������ transferType
�Ļ������顣
IllegalArgumentException
- ��� components
���鲻Ϊ null �Ҳ����ر���ܱ���������ɫ�� alpha ��������ƫ������ͷ�������� pixel
�����ر���ܱ���� ColorModel ������ֵ��public int[] getUnnormalizedComponents(float[] normComponents, int normOffset, int[] components, int offset)
ColorModel
�� ColorSpace
����ָ����ÿ����������Сֵ�����ֵ֮�䡣����� ColorModel
����ɫ����ֵ�������÷DZ�����ʽ��ʾ�����׳� IllegalArgumentException
����� components
����Ϊ null
�������һ�������顣components
���齫���ء�����ɫ/alpha �����洢���� offset
��ͷ�� components
�����У�����˷����ѷ���������Ҳ����ˡ���� components
���鲻Ϊ null
�Ҳ����ر������ offset
��ͷ����������ɫ�� alpha ���������׳� ArrayIndexOutOfBoundsException
����� normComponents
���鲻���ر���ܱ����� normOffset
��ͷ��������ɫ�� alpha ���������׳� IllegalArgumentException
��
ColorModel
�е� getUnnormalizedComponents
normComponents
- ������������������normOffset
- ��ʼ�������������� normComponents
�����ƫ����components
- �� normComponents
��������������offset
- ���䴦��ʼ�洢 normComponents
�� components
������
IllegalArgumentException
- ����� ComponentColorModel
��֧�ַDZ�����ʽ
IllegalArgumentException
- ��� normComponents
�ij��ȼ�ȥ normOffset
�� numComponents
public float[] getNormalizedComponents(int[] components, int offset, float[] normComponents, int normOffset)
ColorModel
�� ColorSpace
����ָ����ÿ����������Сֵ�����ֵ֮�䡣����� ColorModel
����ɫ����ֵ�������÷DZ�����ʽ��ʾ�����׳� IllegalArgumentException
����� normComponents
����Ϊ null
�������һ�������顣normComponents
���齫���ء���ɫ/alpha �����洢���� normOffset
��ͷ�� normComponents
�����У���ʹ�˷����ѷ���������Ҳ��ˡ���� normComponents
���鲻Ϊ null
���Ҳ����ر���ܱ���������ɫ�� alpha �������� normOffset
��ͷ�������׳� ArrayIndexOutOfBoundsException
����� components
���鲻���ر���ܱ����� offset
��ͷ��������ɫ�� alpha ���������׳� IllegalArgumentException
��
ColorModel
�е� getNormalizedComponents
components
- �����DZ�������������offset
- ��ʼ�����DZ��������� components
�����ƫ����normComponents
- �յ���������������normOffset
- ���䴦��ʼ�洢���������� normComponents
������
IllegalArgumentException
- ����� ComponentColorModel
��֧�ַDZ�����ʽpublic int getDataElement(int[] components, int offset)
ColorModel
�б�ʾΪ int ������ֵ���Ѹ����DZ�����ɫ/alpha ���������飩��
ColorModel
�е� getDataElement
components
- �DZ�����ɫ/alpha ���������顣offset
- components
�����ƫ������
IllegalArgumentException
- ����� ColorModel
����һ�����ϵķ�����
IllegalArgumentException
- ����� ComponentColorModel
��֧�ַDZ�����ʽpublic Object getDataElements(int[] components, int offset, Object obj)
ColorModel
�����ص�����Ԫ�������ʾ��ʽ��Ȼ����Խ������鴫�ݸ� WritableRaster
����� setDataElements
������
ColorModel
�е� getDataElements
components
- �DZ�����ɫ/alpha ���������顣offset
- components
���������ƫ������obj
- �����д洢���ص�����Ԫ�������ʾ��ʽ�Ķ������ obj
����Ϊ null������������顣��� obj
��Ϊ null���������Ϊ���� transferType
�Ļ������顣��� obj
�����ر���ܱ���� ColorModel
������ֵ�����׳� ArrayIndexOutOfBoundsException
����Ϊ ComponentColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�����ص�����Ԫ�������ʾ��ʽ��
IllegalArgumentException
- ����������鲻���ر���ܱ���������ƫ������ͷ����ɫ�� alpha ������
ClassCastException
- ��� obj
��Ϊ null �Ҳ�Ϊ���� transferType
�Ļ������顣
ArrayIndexOutOfBoundsException
- ��� obj
�����ر���ܱ���� ColorModel
������ֵ��
IllegalArgumentException
- ����� ComponentColorModel
��֧�ַDZ�����ʽ
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)
int
���ͱ�ʾ�ڴ� ColorModel
�е�����ֵ������� ColorModel
������ֵ�������õ��� int
����˷������׳� IllegalArgumentException
����� normComponents
���鲻���ر���ܱ��������� normOffset
��ͷ����ɫ�� alpha ���������׳� ArrayIndexOutOfBoundsException
��
ColorModel
�е� getDataElement
normComponents
- ������ɫ�� alpha ����������normOffset
- ��ʼ������ɫ�� alpha ������ normComponents
������
ColorModel
�ж�Ӧ��ָ�������� int
����ֵ��
IllegalArgumentException
- ����� ColorModel
������ֵ�������õ��� int
��ʾ
ArrayIndexOutOfBoundsException
- ��� normComponents
���鲻���ر���ܱ����� normOffset
��ͷ��������ɫ�� alpha ����public Object getDataElements(float[] normComponents, int normOffset, Object obj)
ColorModel
�����ص�����Ԫ�������ʾ��ʽ��Ȼ����Խ������鴫�ݸ� WritableRaster
����� setDataElements
��������� normComponents
���鲻���ر���ܱ��������� normOffset
��ͷ����ɫ�� alpha ���������׳� ArrayIndexOutOfBoundsException
����� obj
����Ϊ null
�������һ�������顣��� obj
��Ϊ null
����������Ϊ���� transferType �Ļ������飻�����׳� ClassCastException
����� obj
�����ر���ܱ���� ColorModel
������ֵ�����׳� ArrayIndexOutOfBoundsException
��
ColorModel
�е� getDataElements
normComponents
- ������ɫ�� alpha ����������normOffset
- ��ʼ������ɫ�� alpha ������ normComponents
������obj
- ���淵�ص����صĻ�����������
Object
ClassCastException
- ��� obj
������ transferType
�Ļ�������
ArrayIndexOutOfBoundsException
- ��� obj
�����ر���ܱ���� ColorModel
������ֵ������ normComponents
���鲻���ر���ܱ����� normOffset
��ͷ��������ɫ�� alpha ����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
�и��������صı�����ʽ��ɫ/alpha ���������顣����ֵ����Ϊ�������ô�������� transferType ������Ԫ�ص�����ָ����������ز�Ϊ���� transferType �Ļ������飬���׳� ClassCastException
����� pixel
�����ر���ܱ���� ColorModel
������ֵ�����׳� ArrayIndexOutOfBoundsException
����������Ϊ float ֵ����Щֵ���ڴ� ColorModel
�� ColorSpace
����ָ����ÿ����������Сֵ�����ֵ֮�䡣��� normComponents
����Ϊ null
�������һ�������顣normComponents
���齫���ء���ɫ/alpha �����洢���� normOffset
��ͷ�� normComponents
�����У���ʹ�˷����ѷ���������Ҳ��ˡ���� normComponents
���鲻Ϊ null
���Ҳ����ر���ܱ���������ɫ�� alpha �������� normOffset
��ͷ�������׳� ArrayIndexOutOfBoundsException
��
���ij����ּ���Է�Ĭ�Ϸ�ʽ����������ֵת��Ϊ��ɫ����ֵ��������������д�˷���������ʵ�ֵ�Ĭ��ת�������ע����������ʵ�ַ�Ĭ��ת�����κ����������ѭ�Դ˴����������ת�������ơ�
ColorModel
�е� getNormalizedComponents
pixel
- ָ������normComponents
- ������������������normOffset
- ���䴦��ʼ�洢���������� normComponents
�����ƫ����
ClassCastException
- ��� pixel
��Ϊ���� transferType �Ļ�������
ArrayIndexOutOfBoundsException
- ��� normComponents
�����ر���ܱ����� normOffset
��ͷ��������ɫ�� alpha ����
ArrayIndexOutOfBoundsException
- ��� pixel
�����ر���ܱ���� ColorModel
������ֵ��public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
isAlphaPremultiplied
������ָ����״̬ƥ�䣬�ٶ���ǰ���������ɴ� ColorModel
��ȷ���������Խ���ɫ raster ���ݳ��Ի���� alpha����������ݴ�����ȷ״̬����ִ���κβ����������Ҫ�Ը�����ǿ��ƥ�䣬��˷���������Ӧ�ط���һ������ isAlphaPremultiplied
��־���� ColorModel
��ʵ������Ϊ ColorModel
�������������������Լ̳д˷�����ʵ�֣������������д�˷�����������ʹ�ò���֧�ֵ� transferType
ʱ�����׳��쳣��
ColorModel
�е� coerceData
raster
- WritableRaster
����isAlphaPremultiplied
- ����� alpha Ԥ�ˣ��� 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��
ColorModel
�е� isCompatibleRaster
raster
- ���ڲ��Լ����Ե� Raster
��
raster
��� ColorModel
���ݣ��� true
����������ݣ��� false
��public WritableRaster createCompatibleWritableRaster(int w, int h)
WritableRaster
��������� ColorModel
���ݵ����ݲ��� (SampleModel
)��
ColorModel
�е� createCompatibleWritableRaster
w
- Ҫ������ WritableRaster
�Ŀ��ȡ�h
- Ҫ������ WritableRaster
�ĸ߶ȡ�
ColorModel
���ݵ� WritableRaster
��WritableRaster
,
SampleModel
public SampleModel createCompatibleSampleModel(int w, int h)
SampleModel
��������� ColorModel
���ݵ����ݲ��֡�
ColorModel
�е� createCompatibleSampleModel
w
- Ҫ������ SampleModel
�Ŀ��ȡ�h
- Ҫ������ SampleModel
�ĸ߶ȡ�
ColorModel
���ݵ� SampleModel
��SampleModel
public boolean isCompatibleSampleModel(SampleModel sm)
SampleModel
�Ƿ���� ColorModel
���ݡ�
ColorModel
�е� isCompatibleSampleModel
sm
- ���ڲ��Լ����Ե� SampleModel
��
SampleModel
��� ColorModel
���ݣ��� true
����������ݣ��� false
��SampleModel
public WritableRaster getAlphaRaster(WritableRaster raster)
Raster
��ȡ���� alpha ͨ���� Raster
���˷����ٶ���� ColorModel
������ Raster
���� alpha band������У��洢Ϊͼ�����ݵ����һ�� band�������������� ColorModel
��صĶ����ռ� alpha ͨ������ null���˷�������һ���µ� Raster
�����ǹ���ԭ�����������顣
ColorModel
�е� getAlphaRaster
raster
- ������ȡ alpha ͨ���� WritableRaster
��
WritableRaster
��public boolean equals(Object obj)
ColorModel
�е� equals
obj
- Ҫ�����ɫģ�ͱȽϵĶ���
true
���������ȣ��� false
��Object.hashCode()
,
Hashtable
|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������