public class ComponentColorModel extends ColorModel
ColorModel类,用于将颜色和alpha信息表示为单独样本的像素值,并将每个样本存储在单独的数据元素中。 
       这个类可以随意使用ColorSpace 。 
       颜色样本中的像素值的数量必须相同的颜色分量的数目ColorSpace 。 
       可能有一个单一的α样本。 
        对于那些使用类型的基本数组像素表示方法transferType ,数组的长度是相同的颜色和alpha样本的数量。 颜色样本首先存储在数组中,然后存储alpha样本。 颜色样本的顺序由ColorSpace 。 通常,此顺序反映了颜色空间类型的名称。 例如,对于TYPE_RGB ,索引0对应于红色,索引1为绿色,索引2为蓝色。 
 从显示或处理目的的像素样本值到颜色/α分量的转换是基于样本与分量的一一对应关系。 根据用于创建ComponentColorModel实例的传输类型,由该实例表示的像素样本值可以是有符号的或无符号的,并且可以是整数类型或浮点或双倍(详见下文)。 从样本值到归一化颜色/α分量的转换必须遵循某些规则。 对于浮点和双样本,转换是一个标识,即归一化分量值等于相应的样本值。 对于积分样本,平移应该只是一个简单的尺度和偏移,其中每个分量的比例和偏移常数可能不同。 应用比例和偏移常数的结果是一组颜色/α分量值,这些值保证在一定范围内。 通常,颜色分量的范围将是ColorSpace类别的getMinValue和getMaxValue方法定义的范围。 Alpha组件的范围应为0.0到1.0。 
 的实例ComponentColorModel用传输类型创建DataBuffer.TYPE_BYTE , DataBuffer.TYPE_USHORT和DataBuffer.TYPE_INT具有被视为无符号整数值的像素样本值。 像素值的颜色或alpha样本中的位数可能与传递给ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)构造函数的相应颜色或alpha样本的ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)不同。 在这种情况下,该类假设样本值的最低有效n位保存分量值,其中n是传递给构造函数的分量的有效位数。 它还假定样本值中的任何高阶位都为零。 因此,样本值范围为0到2 n - 1。该类将这些样本值映射到归一化的颜色分量值,使得0映射到从每个分量的ColorSpace's getMinValue方法获得的值,2 n -1映射到获得的值从getMaxValue 。 要创建具有ComponentColorModel颜色样本映射的ComponentColorModel,需要对此类进行子类化并覆盖getNormalizedComponents(Object, float[], int)方法。 alpha样本的映射始终将0映射到0.0和2 n - 1到1.0。 
 对于具有无符号样本值的实例,仅当两个条件成立时才支持非标准化颜色/ alpha分量表示。 首先,样本值0必须映射到归一化分量值0.0和样本值2 n - 1到1.0。 第二对的所有颜色分量的最小/最大范围ColorSpace必须是0.0到1.0。 在这种情况下,分量表示是相应样本的n个最低有效位。 因此,每个分量是0和2 n -1之间的无符号积分值,其中n是特定分量的有效位数。 如果不满足这些条件,任何采用非规范化组件参数的方法将抛出IllegalArgumentException 。 
 的实例ComponentColorModel用传输类型创建DataBuffer.TYPE_SHORT , DataBuffer.TYPE_FLOAT和DataBuffer.TYPE_DOUBLE具有被视为有符号短,浮点型或双值的像素样本值。 这样的情况下不支持非标准化的颜色/α-分量表示,所以采用这样的表示形式作为参数的任何方法将抛出IllegalArgumentException在这些实例中的一个调用时。 该类的实例的归一化组件值具有取决于传输类型的范围,如下所示:对于浮动样本,浮点数据类型的全范围; 对于双样本,浮点数据类型的全范围(由铸造双倍浮动) 对于短样本,从大约-maxVal到+ maxVal,其中maxVal是ColorSpace (-32767映射到-maxVal,0映射到0.0和32767映射到+ maxVal)的每个分量最大值。 子类可以通过覆盖getNormalizedComponents(Object, float[], int)方法来覆盖短样本值到归一化组件值的缩放。 对于浮动和双样本,归一化分量值取为等于相应的样本值,子类不应尝试为这些传输类型添加任何非标识缩放。 
 的实例ComponentColorModel用传输类型创建DataBuffer.TYPE_SHORT , DataBuffer.TYPE_FLOAT和DataBuffer.TYPE_DOUBLE使用所有采样值的所有位。 因此,所有的颜色/ alpha分量使用时具有16位DataBuffer.TYPE_SHORT使用时,32位DataBuffer.TYPE_FLOAT使用时,和64位DataBuffer.TYPE_DOUBLE 。 当这些传输类型之一使用ComponentColorModel(ColorSpace, int[], boolean, boolean, int, int)形式的构造函数时,将忽略位数组参数。 
 可能会有不能合理地将颜色/ alpha样本值解释为渲染的组件值。 当ComponentColorModel被子类化以覆盖无符号样本值到归一化颜色分量值的映射或者使用特定范围之外的带符号样本值时,可能会发生这种情况。 (例如,将α分量指定为范围0到32767之外的带符号短值,归一化范围为0.0到1.0,可能会导致意想不到的结果)。应用程序有责任在渲染之前适当地缩放像素数据,使得颜色组件落在ColorSpace (使用ColorSpace类的getMinValue和getMaxValue方法获得)的归一化范围内,并且α分量在0.0和1.0之间。 如果颜色或α分量值落在这些范围之外,则渲染结果是不确定的。 
 使用单个int像素表示法的方法抛出IllegalArgumentException ,除非ComponentColorModel的ComponentColorModel为1,组件值为无符号 - 换句话说,使用DataBuffer.TYPE_USHORT或DataBuffer.TYPE_INT的传输类型的DataBuffer.TYPE_BYTE DataBuffer.TYPE_USHORT ,以及没有阿尔法 
 甲ComponentColorModel可以结合使用具有ComponentSampleModel ,一个BandedSampleModel ,或PixelInterleavedSampleModel构建BufferedImage 。 
pixel_bits, transferTypeBITMASK, OPAQUE, TRANSLUCENT| Constructor and Description | 
|---|
| 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从指定的参数。 | 
| Modifier and Type | Method and Description | 
|---|---|
| ColorModel | coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
              强制光栅数据与 
              isAlphaPremultiplied变量中指定的状态相匹配,假设数据目前由该ColorModel。 | 
| SampleModel | createCompatibleSampleModel(int w, int h)
              创建具有 
              SampleModel宽度和高度的SampleModel,具有与此ColorModel的数据布局。 | 
| WritableRaster | createCompatibleWritableRaster(int w, int h)
              创建具有 
              WritableRaster宽度和高度的WritableRaster,具有与此ColorModel的数据布局(SampleModel)。 | 
| boolean | equals(Object obj)
              将此颜色模型与另一种颜色模型进行比较以获得相等性。 
             | 
| int | getAlpha(int pixel)
              返回指定像素的alpha分量,从0到255。 
             | 
| int | getAlpha(Object inData)
              返回指定像素的alpha分量,从0到255。 
             | 
| WritableRaster | getAlphaRaster(WritableRaster raster)
              返回一个 
              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给出了一个像素的非规范化颜色/ alpha分量的数组。 | 
| int[] | getComponents(Object pixel, int[] components, int offset)
              在此 
              ColorModel给出一个像素的非规范化颜色/ alpha分量的数组。 | 
| int | getDataElement(float[] normComponents, int normOffset)
              返回一个像 
              int在ColorModel中表示的像素值,给出了一组归一化的颜色/ alpha分量。 | 
| int | getDataElement(int[] components, int offset)
              返回表示为在此一个int的像素值 
              ColorModel,给定非标准化颜色/ alpha分量的阵列。 | 
| Object | getDataElements(float[] normComponents, int normOffset, Object obj)
              返回此的像素的数据元素数组表示 
              ColorModel,给定的归一化的颜色/ alpha分量的阵列。 | 
| Object | getDataElements(int[] components, int offset, Object obj)
              给定一个非规范化颜色/ alpha分量的数组,返回此 
              ColorModel中像素的数据元素数组表示。 | 
| Object | getDataElements(int rgb, Object pixel)
              返回此的像素的数据元素数组表示 
              ColorModel给出在默认RGB颜色模型中的整数像素表示。 | 
| int | getGreen(int pixel)
              返回指定像素的绿色分量,在默认RGB ColorSpace sRGB中从0到255。 
             | 
| int | getGreen(Object inData)
              返回指定像素的绿色分量,在默认RGB 
              ColorSpacesRGB中从0到255。 | 
| float[] | getNormalizedComponents(int[] components, int offset, float[] normComponents, int normOffset)
              给定一个非规范化的组件数组,以归一化形式返回所有颜色/ alpha分量的数组。 
             | 
| float[] | getNormalizedComponents(Object pixel, float[] normComponents, int normOffset)
              在这个 
              ColorModel中给出一个像素,返回标准化形式的所有颜色/ alpha分量的ColorModel。 | 
| 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)
              给定一个归一化的组件数组,以非规范化形式返回所有颜色/ alpha分量的数组。 
             | 
| boolean | isCompatibleRaster(Raster raster) 
             如果 raster与此ColorModel,则返回true; 
             假如不是的话。 | 
| boolean | isCompatibleSampleModel(SampleModel sm)
              检查指定是否 
              SampleModel与此兼容ColorModel。 | 
finalize, getColorSpace, getComponentSize, getComponentSize, getNumColorComponents, getNumComponents, getPixelSize, getRGBdefault, getTransferType, getTransparency, hasAlpha, hashCode, isAlphaPremultiplied, toStringpublic 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中的ColorSpace数,或者如果有阿尔法信息。 
           当transferType是DataBuffer.TYPE_SHORT , DataBuffer.TYPE_FLOAT ,或DataBuffer.TYPE_DOUBLE的bits数组参数被忽略。 
           hasAlpha指示是否存在α信息。 
           如果hasAlpha为真,则布尔值isAlphaPremultiplied指定如何在像素值中解释颜色和alpha样本。 
           如果布尔值为真,则假定颜色样本已被乘以α样本。 
           transparency指定此颜色模型可以表示哪些alpha值。 
           可接受transparency值是OPAQUE , BITMASK或TRANSLUCENT 。 
           transferType是用于表示像素值的原始数组的类型。 
          colorSpace - 与此颜色模型相关 
            ColorSpace ColorSpace。 
           bits - 每个组件的有效位数。 
            可能为null,在这种情况下,所有组件样本的所有位都将显着。 
            忽略如果transferType时是一个DataBuffer.TYPE_SHORT , DataBuffer.TYPE_FLOAT ,或DataBuffer.TYPE_DOUBLE ,在这种情况下,所有分量样本的所有位将是显著。 
           hasAlpha - 如果是,该颜色模型支持alpha。 
           isAlphaPremultiplied - 如果为真,则为预付费。 
           transparency - 指定此颜色模型可以表示哪些Alpha值。 
           transferType - 指定用于表示像素值的基本数组的类型。 
           IllegalArgumentException -如果 
            bits数组参数不为空,其长度小于颜色和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,66,32或64。 
           ColorSpace的颜色分量数将是组件的ColorSpace 。 
           如果hasAlpha是true将会有一个alpha true 。 
           如果hasAlpha为真,则布尔值isAlphaPremultiplied指定如何在像素值中解释颜色和alpha样本。 
           如果布尔值为真,则假定颜色样本已被乘以α样本。 
           transparency指定此颜色模型可以表示哪些alpha值。 
           可接受transparency值是OPAQUE , BITMASK或TRANSLUCENT 。 
           transferType是用于表示像素值的原始数组的类型。 
          colorSpace - 与此颜色模型 
            ColorSpace ColorSpace。 
           hasAlpha - 如果为true,此颜色模型支持alpha。 
           isAlphaPremultiplied - 如果为真,则为预乘。 
           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)
getRed在 
            ColorModel类 
           pixel - 要从中获取红色分量的像素。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException -如果此组件值 
            ColorModel签署 
           public int getGreen(int pixel)
getGreen在 
            ColorModel 
           pixel - 要从中获取绿色分量的像素。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException -如果此组件值 
            ColorModel签署 
           public int getBlue(int pixel)
getBlue在 
            ColorModel 
           pixel - 要从中获取蓝色分量的像素。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException -如果此组件值 
            ColorModel签署 
           public int getAlpha(int pixel)
getAlpha在 
            ColorModel 
           pixel - 要从中获取alpha分量的像素。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException -如果此组件值 
            ColorModel签署 
           public int getRGB(int pixel)
getRGB在 
            ColorModel 
           pixel - 要从中获取颜色/ alpha分量的像素。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException -如果此组件值 
            ColorModel签署 
           ColorModel.getRGBdefault() 
           public int getRed(Object inData)
pixel值由作为对象引用传递的类型为transferType的数据元素数组指定。 
           返回的值将是非预倍增值。 
           如果alpha被预乘,则此方法在返回值之前将其除数(如果alpha值为0,则红色值为0)。 
           由于ComponentColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果使用不支持的transferType ,则它们会引发transferType 。 
          getRed在 
            ColorModel 
           inData - 要从中获取红色颜色分量的像素,由 
            transferType类型的数据元素数组 
            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,它们将抛出transferType 。 
          getGreen在 
            ColorModel 
           inData - 要从中获取绿色分量的像素,由 
            transferType类型的数据元素数组 
            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,它们将抛出transferType 。 
          getBlue在 
            ColorModel类 
           inData - 要从中获取蓝色分量的像素,由数组元素 
            transferType数组 
            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的数据元素数组transferType为对象引用。 
           由于ComponentColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果使用不支持的transferType,它们将抛出transferType 。 
          getAlpha在 
            ColorModel 
           inData - 要从中获取alpha分量的像素,由 
            transferType类型的数据元素数组 
            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,它们将抛出transferType 。 
          getRGB在 
            ColorModel 
           inData - 要从中获取颜色/ alpha分量的像素,由 
            transferType类型的数据元素数组 
            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给出在默认RGB颜色模型中的整数像素表示。 
           然后可以将该数组传递给WritableRaster对象的setDataElements方法。 
           如果pixel参数为null, pixel分配一个新数组。 
           由于ComponentColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果他们使用不支持的transferType,它们会引发transferType 。 
          getDataElements在 
            ColorModel 
           rgb - RGB颜色模型中像素的整数表示 
           pixel - 指定的像素 
           ColorModel 。 
           ClassCastException - 如果 
            pixel不为空并且不是类型为 
            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给出一个像素的非规范化颜色/ alpha分量的数组。 
           如果此组件值,则抛出ColorModel是不便于用非标准化形式表示。 
           颜色/ alpha分量存储中components数组以offset (即使该阵列由这种方法分配的)。 
          getComponents在 
            ColorModel 
           pixel - 以整数 
            pixel的像素值。 
           components - 用于存储非规范化颜色/ alpha分量的整数数组。 
            如果components数组为空,则会分配一个新数组。 
           offset - 一个偏移到 
            components数组。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException - 如果这个 
            ColorModel不支持非规范化形式 
           ArrayIndexOutOfBoundsException - 如果 
            components数组不为空,并且不够大,不能容纳所有颜色和alpha分量(从偏移开始)。 
           public int[] getComponents(Object pixel, int[] components, int offset)
ColorModel给出一个像素的非规范化颜色/ alpha分量的数组。 
           的像素值是由类型的数据元素的数组指定transferType传入作为对象引用。 
           如果此组件值,则抛出ColorModel不便于用非标准化形式表示。 
           颜色/ alpha分量存储中components数组以offset (即使该阵列由这种方法分配的)。 
           由于ComponentColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果使用不支持的transferType ,则此方法可能会引发transferType 。 
          getComponents在 
            ColorModel 
           pixel - 由 
            transferType类型的数据元素数组指定的像素值。 
           components - 存储非标准化颜色/ alpha分量的整数数组。 
            如果components数组为空,则会分配一个新数组。 
           offset - 偏移到 
            components数组。 
           components数组。 
           IllegalArgumentException - 如果这个 
            ComponentColorModel不支持非规范化形式 
           UnsupportedOperationException -在某些情况下,当且仅当该移交类型 
            ComponentColorModel不是以下传输类型之一: 
            DataBuffer.TYPE_BYTE , 
            DataBuffer.TYPE_USHORT ,或 
            DataBuffer.TYPE_INT 。 
           ClassCastException -如果 
            pixel不是类型的基本数组 
            transferType 。 
           IllegalArgumentException - 如果 
            components数组不为空,并且不够大,不足以容纳所有颜色和alpha分量(从偏移开始),或者如果 
            pixel不够大,不能容纳该ColorModel的像素值。 
           public int[] getUnnormalizedComponents(float[] normComponents,
                                       int normOffset,
                                       int[] components,
                                       int offset) 
          ColorSpace对象此ColorModel 。 
           一个IllegalArgumentException如果这种颜色成分值会被抛出ColorModel不便于用非标准化形式表示。 
           如果components阵列是null ,则会null一个新的数组。 
           将返回components数组。 
           颜色/ alpha分量存储中components数组以offset (即使该阵列由这种方法分配的)。 
           一个ArrayIndexOutOfBoundsException如果被抛出components数组不null ,不足够大以容纳所有的颜色和alpha分量(开始于offset )。 
           一个IllegalArgumentException如果抛出normComponents阵列是不是大到足以容纳所有开始在颜色和alpha分量normOffset 。 
          getUnnormalizedComponents在 
            ColorModel类 
           normComponents - 包含归一化组件的数组 
           normOffset - 
            normComponents数组的偏移量,用于开始检索归一化组件 
           components - 从 
            normComponents接收组件的 
            normComponents 
           offset -索引为 
            components ,从此处开始从存储标准化分量 
            normComponents 
           IllegalArgumentException - 如果这个 
            ComponentColorModel不支持非规范化形式 
           IllegalArgumentException - 如果 
            normComponents减去 
            normOffset的长度小于 
            numComponents 
           public float[] getNormalizedComponents(int[] components,
                                       int offset,
                                       float[] normComponents,
                                       int normOffset) 
          ColorSpace对象此ColorModel 。 
           一个IllegalArgumentException如果这种颜色成分值会被抛出ColorModel不便于用非标准化形式表示。 
           如果normComponents阵列为null , null一个新阵列。 
           将返回normComponents数组。 
           颜色/ alpha分量存储中normComponents数组以normOffset (即使该阵列由这种方法分配的)。 
           一个ArrayIndexOutOfBoundsException如果被抛出normComponents数组不null ,不足够大以容纳所有的颜色和alpha分量(开始于normOffset )。 
           一个IllegalArgumentException如果抛出components阵列是不是大到足以容纳所有开始在颜色和alpha分量offset 。 
          getNormalizedComponents在 
            ColorModel 
           components - 包含非规范化组件的数组 
           offset - 
            components阵列的偏移量,用于开始检索非规范化组件 
           normComponents - 接收标准化组件的数组 
           normOffset - 索引到 
            normComponents开始存储归一化组件 
           IllegalArgumentException - 如果这个 
            ComponentColorModel不支持非规范化形式 
           public int getDataElement(int[] components,
                          int offset) 
          ColorModel ,给定非标准化颜色/ alpha分量的阵列。 
          getDataElement在 
            ColorModel 
           components - 非规范化颜色/ alpha组件的数组。 
           offset - 偏移到 
            components阵列。 
           IllegalArgumentException - 如果这个 
            ColorModel有多个 
            ColorModel 。 
           IllegalArgumentException - 如果这个 
            ComponentColorModel不支持非规范化形式 
           public Object getDataElements(int[] components, int offset, Object obj)
ColorModel中像素的数据元素数组表示。 
           然后可以将该数组传递给WritableRaster对象的setDataElements方法。 
          getDataElements在 
            ColorModel 
           components - 非规范化颜色/ alpha组件的数组。 
           offset - 
            components数组中的整数偏移量。 
           obj - 存储像素的数据元素数组表示形式的对象。 
            如果obj变量为null,则会分配一个新数组。 
            如果obj不为空,它必须是类型的基本数组transferType 。 
            一个ArrayIndexOutOfBoundsException如果抛出obj是不是大到足以容纳这个像素值ColorModel 。 
            由于ComponentColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果他们使用不支持的transferType,它们将抛出transferType 。 
           ColorModel 。 
           IllegalArgumentException - 如果组件数组不够大,不能容纳所有颜色和alpha组件(从偏移开始)。 
           ClassCastException - 如果 
            obj不为空并且不是类型为 
            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) 
          int在此ColorModel ,给定的归一化的颜色/ alpha分量的阵列。 
           此方法将抛出一个IllegalArgumentException如果这个像素值ColorModel是不是作为一个单一的便于表示int 。 
           一个ArrayIndexOutOfBoundsException如果被抛出normComponents阵列是没有大到足以容纳所有的颜色和alpha分量(开始于normOffset )。 
          getDataElement在 
            ColorModel 
           normComponents - 归一化颜色和α分量的数组 
           normOffset - 索引到 
            normComponents开始检索颜色和alpha组件 
           int像素值在这个 
            ColorModel对应的指定组件。 
           IllegalArgumentException - 如果这个 
            ColorModel像素值不方便地表示为一个 
            int 
           ArrayIndexOutOfBoundsException -如果 
            normComponents阵列是没有大到足以容纳所有的颜色和alpha分量开始于 
            normOffset 
           public Object getDataElements(float[] normComponents, int normOffset, Object obj)
ColorModel中像素的数据元素数组表示。 
           然后可以将该数组传递给WritableRaster对象的setDataElements方法。 
           一个ArrayIndexOutOfBoundsException如果被抛出normComponents阵列是没有大到足以容纳所有的颜色和alpha分量(开始于normOffset )。 
           如果obj变量为null , null一个新数组。 
           如果obj不是null ,它必须是一个类型为transferType的基本数组; 
           否则,抛出一个ClassCastException 。 
           一个ArrayIndexOutOfBoundsException如果抛出obj是不是大到足以容纳这个像素值ColorModel 。 
          getDataElements在 
            ColorModel 
           normComponents - 归一化颜色和alpha分量的数组 
           normOffset - 索引到 
            normComponents开始检索颜色和alpha组件 
           obj - 用于保存返回像素的原始数据数组 
           Object是像素的原始数据阵列表示 
           ClassCastException -如果 
            obj不是类型的基本数组 
            transferType 
           ArrayIndexOutOfBoundsException -如果 
            obj是不足够大以保存此像素值 
            ColorModel或 
            normComponents阵列是没有大到足以容纳所有的颜色和alpha分量开始于 
            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一个像素,返回标准化形式的所有颜色/ alpha分量的ColorModel 。 
           像素值由作为对象引用传入的transferType类型的数据元素数组指定。 
           如果像素不是transferType类型的原始数组,则会抛出一个ClassCastException 。 
           一个ArrayIndexOutOfBoundsException如果抛出pixel是不是大到足以容纳这个像素值ColorModel 。 
           正规化成分是每分量最小和最大由指定之间的浮点值ColorSpace对象此ColorModel 。 
           如果normComponents数组是null ,则会null一个新数组。 
           将返回normComponents数组。 
           颜色/ alpha分量存储中normComponents数组以normOffset (即使该阵列由这种方法分配的)。 
           一个ArrayIndexOutOfBoundsException如果被抛出normComponents数组不null ,不足够大以容纳所有的颜色和alpha分量(开始于normOffset )。 
           如果该子类被设计为以非默认方式将像素样本值转换为颜色分量值,则该方法必须被子类覆盖。 该类实现的默认翻译在类注释中描述。 实现非默认翻译的任何子类必须遵循在那里定义的允许翻译的约束。
getNormalizedComponents在 
            ColorModel 
           pixel - 指定的像素 
           normComponents - 用于接收标准化组件的数组 
           normOffset - 
            normComponents阵列的偏移量,用于开始存储归一化分量 
           ClassCastException - 如果 
            pixel不是transferType类型的原始数组 
           ArrayIndexOutOfBoundsException -如果 
            normComponents是不是大到足以容纳所有的颜色和alpha分量开始 
            normOffset 
           ArrayIndexOutOfBoundsException - 如果 
            pixel不够大,不能持有这个 
            ColorModel的像素值。 
           public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied)
isAlphaPremultiplied变量中指定的状态相匹配,假设数据当前由ColorModel 。 
           它可以将颜色光栅数据乘以或除以α,如果数据处于正确状态,则不执行任何操作。 
           如果需要强制数据,那么这个方法也会返回一个这样的ColorModel一个实例,其中isAlphaPremultiplied标志是适当的。 
           由于ColorModel可以被子类化,子类继承了该方法的实现,如果它们不覆盖它,那么如果使用不支持的transferType,它们将抛出transferType 。 
          coerceData在 
            ColorModel 
           raster - 
            WritableRaster数据 
           isAlphaPremultiplied - true如果alpha是预乘的; 
            false否则 
           ColorModel强制数据的 
            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; 
           假如不是的话。 
          isCompatibleRaster类 
            ColorModel 
           raster - 
            Raster对象测试兼容性。 
           true如果 
            raster与此兼容 
            ColorModel , 
            false ,如果它不是。 
           public WritableRaster createCompatibleWritableRaster(int w, int h)
WritableRaster具有指定的宽度和高度,具有数据布局( 
           SampleModel )与此兼容 
           ColorModel 。 
          createCompatibleWritableRaster在 
            ColorModel 
           w - 您要创建的 
            WritableRaster的宽度。 
           h - 要创建的 
            WritableRaster的高度。 
           WritableRaster与此 
            ColorModel 。 
           WritableRaster , SampleModel 
           public SampleModel createCompatibleSampleModel(int w, int h)
SampleModel具有指定的宽度和高度,具有与此兼容的数据布局 
           ColorModel 。 
          createCompatibleSampleModel在 
            ColorModel 
           w - 要创建的 
            SampleModel的宽度。 
           h - 要创建的 
            SampleModel的高度。 
           SampleModel与此 
            ColorModel 。 
           SampleModel 
           public boolean isCompatibleSampleModel(SampleModel sm)
SampleModel与此兼容 
           ColorModel 。 
          isCompatibleSampleModel在 
            ColorModel 
           sm -该 
            SampleModel测试对于兼容性。 
           true如果 
            SampleModel与此兼容 
            ColorModel , 
            false ,如果它不是。 
           SampleModel 
           public WritableRaster getAlphaRaster(WritableRaster raster)
Raster ,表示图像的alpha通道,从输入Raster 。 
           该方法假设与此ColorModel Raster对象存储了α带(如果存在)作为最后一个图像数据。 
           如果没有与此ColorModel单独的空间alpha通道,则返回null。 
           此方法创建一个新的Raster ,但将共享数据数组。 
          getAlphaRaster在 
            ColorModel类 
           raster - 从中提取alpha通道的 
            WritableRaster 。 
           WritableRaster包含图像的Alpha通道。 
           public boolean equals(Object obj)
equals在 
            ColorModel类 
           obj - 与此颜色模型进行比较的对象。 
           true如果颜色模型对象相等, 
            false如果不是。 
           Object.hashCode(), 
            HashMap 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.