java命名空间java.awt.image类colormodel的类成员方法:
getcomponents定义及介绍
本文导语:
getcomponents
public int[] getcomponents(int pixel,
int[] components,
int offset)
返回在 colormodel 中已给定像素的非标准化颜色/alpha 分量。将像素值指定为 int。如果此 colormodel 的像素值不便于用单个 in...
getcomponents
public int[] getcomponents(int pixel,
int[] components,
int offset)
- 返回在
colormodel 中已给定像素的非标准化颜色/alpha 分量。将像素值指定为 int。如果此 colormodel 的像素值不便于用单个 int 表示,或者此 colormodel 的颜色分量值不便于以非标准化形式表示,则将抛出 illegalargumentexception。例如,此方法可用于检索 directcolormodel 中特定像素值的分量。如果分量数组为 null,则分配一个新数组。该分量数组将被返回。将颜色/alpha 分量存储在以 offset 开头的 component 数组中,即便此方法已分配了数组也如此。如果分量数组不为 null,且不是特别大,不能存储以偏移量开头的所有颜色和 alpha 分量,则抛出 arrayindexoutofboundsexception。因为 colormodel 为抽象类,所以任何实例都是子类的实例。子类必须重写此方法,因为此抽象类中的实现抛出了 unsupportedoperationexception。
- 参数:
pixel - 指定的像素components - 收到指定像素的颜色和 alpha 分量的数组offset - 开始存储颜色和 alpha 分量时的 components 数组的偏移量
- 返回:
- 包含以指定偏移量开头的指定像素的颜色和 alpha 分量的数组。
- 抛出:
unsupportedoperationexception - 如果此方法不受此 colormodel 支持