java命名空间java.awt.image类directcolormodel的类成员方法:
getcomponents定义及介绍
本文导语:
getcomponents
public final int[] getcomponents(object pixel,
int[] components,
int offset)
返回在 colormodel 中已给定像素的未标准化颜色/alpha 分量。像素值由作为对象引用传入的类型 transfertype ...
getcomponents
public final int[] getcomponents(object pixel,
int[] components,
int offset)
- 返回在
colormodel 中已给定像素的未标准化颜色/alpha 分量。像素值由作为对象引用传入的类型 transfertype 的数据元素的数组指定。如果 pixel 不是类型 transfertype 的基本数组,则抛出 classcastexception。如果 pixel 不是特别大,不能存储此 colormodel 的像素值,则抛出 arrayindexoutofboundsexception。如果该 components 数组为 null,则分配一个新数组。该 components 数组被返回。将颜色/alpha 分量存储在以 offset 开头的 components 数组中,即便此方法已分配了数组也如此。如果 components 数组不为 null 且不是特别大,不能以 offset 开头存储所有颜色和 alpha 分量,则抛出 arrayindexoutofboundsexception。因为 directcolormodel 可以子类化,所以子类可以继承此方法的实现,并且如果不重写此方法,则当它们使用不受支持的 transfertype 时,将抛出异常。
- 覆盖:
- 类
colormodel 中的 getcomponents
- 参数:
pixel - 指定的像素components - 接收指定像素的颜色和 alpha 分量的数组offset - 开始存储颜色和 alpha 分量时的 components 数组的偏移量
- 返回:
- 包含以指定偏移量开头的指定像素的颜色和 alpha 分量的数组。
- 抛出:
classcastexception - 如果 pixel 不是类型 transfertype 的基本数组
arrayindexoutofboundsexception - 如果 pixel 不是特别大,不能存储此 colormodel 的像素值,或如果 components 不为 null 且不是特别大,不能以 offset 开头保存所有颜色和 alpha 分量
unsupportedoperationexception - 如果此 transfertype 不受此颜色模型支持