public final class ColorSpaceTransform
extends Object
java.lang.Object | |
↳ | android.hardware.camera2.params.ColorSpaceTransform |
不可变类,用于按行优先顺序描述 Rational
值的3x3矩阵。
该矩阵映射从一个颜色空间到另一个颜色空间的变换。 对于特定的色彩空间来源和目标,请参阅提供此值的键的适当相机元数据文档。
也可以看看:
Public constructors |
|
---|---|
ColorSpaceTransform(Rational[] elements) 从 |
|
ColorSpaceTransform(int[] elements) 从 |
Public methods |
|
---|---|
void |
copyElements(int[] destination, int offset) 将 |
void |
copyElements(Rational[] destination, int offset) 将主矩阵中的 |
boolean |
equals(Object obj) 检查这个 |
Rational |
getElement(int column, int row) 通过行和列获取此矩阵的元素。 |
int |
hashCode() 返回对象的哈希码值。 |
String |
toString() 以字符串表示形式返回颜色空间转换。 |
Inherited methods |
|
---|---|
From class java.lang.Object
|
ColorSpaceTransform (Rational[] elements)
从 Rational
阵列创建一个新的不可变 ColorSpaceTransform
实例。
这些元素必须以行主要顺序存储。
Parameters | |
---|---|
elements |
Rational : An array of 9 elements |
Throws | |
---|---|
IllegalArgumentException |
if the count of elements is not 9 |
NullPointerException |
if elements or any sub-element is null |
ColorSpaceTransform (int[] elements)
从 int
阵列创建一个新的不可变 ColorSpaceTransform
实例。
这些元素必须以行主要顺序存储。 每个理性都被连续存储为一对(numerator, denominator)
。
尤其是:
int[] elements = new int[
N11, D11, N12, D12, N13, D13,
N21, D21, N22, D22, N23, D23,
N31, D31, N32, D32, N33, D33
];
new ColorSpaceTransform(elements)
where
Nij
and
Dij
is the numerator and denominator for row
i
and column
j
.
Parameters | |
---|---|
elements |
int : An array of 18 elements |
Throws | |
---|---|
IllegalArgumentException |
if the count of elements is not 18 |
NullPointerException |
if elements is null |
void copyElements (int[] destination, int offset)
将主矩阵中的 Rational
元素从该矩阵复制到目标中。
每个元素都被存储为一个连续的合理包装,作为一个 (numerator, denominator)
整数对,与 constructor
相同。
Parameters | |
---|---|
destination |
int : an array big enough to hold at least 18 elements after the offset |
offset |
int : a non-negative offset into the array |
Throws | |
---|---|
NullPointerException |
If destination was null |
ArrayIndexOutOfBoundsException |
If there's not enough room to write the elements at the specified destination and offset. |
也可以看看:
void copyElements (Rational[] destination, int offset)
将 Rational
元素以行优先顺序从此矩阵复制到目标中。
Parameters | |
---|---|
destination |
Rational : an array big enough to hold at least 9 elements after the offset |
offset |
int : a non-negative offset into the array |
Throws | |
---|---|
NullPointerException |
If destination was null |
ArrayIndexOutOfBoundsException |
If there's not enough room to write the elements at the specified destination and offset. |
boolean equals (Object obj)
检查这 ColorSpaceTransform
是否等于另一个 ColorSpaceTransform
。
两个颜色空间变换当且仅当它们的所有元素都是 equal
。
Parameters | |
---|---|
obj |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if the objects were equal, false otherwise |
Rational getElement (int column, int row)
通过行和列获取此矩阵的元素。
行必须在[0,3)范围内,且列必须在[0,3)范围内。
Parameters | |
---|---|
column |
int
|
row |
int
|
Returns | |
---|---|
Rational |
element (non-null ) |
Throws | |
---|---|
IllegalArgumentException |
if column or row was out of range |
int hashCode ()
返回对象的哈希码值。 为了散列表的好处而支持此方法,例如由HashMap
提供的HashMap
。
hashCode
的总合同是:
hashCode
method must consistently return the same integer, provided no information used in equals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. equals(Object)
method, then calling the hashCode
method on each of the two objects must produce the same integer result. equals(java.lang.Object)
method, then calling the hashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables. 尽可能合理实用,由类Object
定义的hashCode方法确实为不同的对象返回不同的整数。 (这通常通过将对象的内部地址转换为整数来实现,但Java TM编程语言不需要此实现技术。)
Returns | |
---|---|
int |
a hash code value for this object. |
String toString ()
以字符串表示形式返回颜色空间转换。
Example: "ColorSpaceTransform([1/1, 0/1, 0/1], [0/1, 1/1, 0/1], [0/1, 0/1, 1/1])"
is an identity transform. Elements are printed in row major order.
Returns | |
---|---|
String |
string representation of color space transform |