public final class ScriptIntrinsicColorMatrix
extends ScriptIntrinsic
| java.lang.Object | ||||
| android.renderscript.BaseObj | ||||
| android.renderscript.Script | ||||
| android.renderscript.ScriptIntrinsic | ||||
| android.renderscript.ScriptIntrinsicColorMatrix | ||||
将颜色矩阵应用于分配的固有内容。 如果元素类型为UNSIGNED_8 ,则将其转换为FLOAT_32并从(0-255)到(0-1)进行归一化。 如果传入矢量大小小于4,则通过用零填充缺失的矢量通道来创建F32_4(RenderScript) 。 然后将该值乘以rsMatrixMultiply()所执行的4x4颜色矩阵,并添加F32_4(RenderScript) ,然后将其写入输出Allocation 。 如果ouptut类型是无符号的,则从(0-1)到(0-255)进行归一化并转换。 如果输出矢量大小小于4,则丢弃未使用的通道。 支持的元素类型是U8(RenderScript) , U8_2(RenderScript) , U8_3(RenderScript) , U8_4(RenderScript) , F32(RenderScript) , F32_2(RenderScript) , F32_3(RenderScript) ,和F32_4(RenderScript) 。
公共方法(Public methods) |
|
|---|---|
static ScriptIntrinsicColorMatrix |
create(RenderScript rs, Element e) 此方法在API级别19中已弃用。使用单参数版本,因为元素现在被忽略。 |
static ScriptIntrinsicColorMatrix |
create(RenderScript rs) 创建用于将颜色矩阵应用于分配的内在因素。 |
void |
forEach(Allocation ain, Allocation aout) 调用内核并将矩阵应用于输入 |
void |
forEach(Allocation ain, Allocation aout, Script.LaunchOptions opt) 调用内核并将矩阵应用于输入 |
Script.KernelID |
getKernelID() 为此内核获取KernelID。 |
void |
setAdd(float r, float g, float b, float a) 设置应用颜色矩阵后要添加的值。 |
void |
setAdd(Float4 f) 设置应用颜色矩阵后要添加的值。 |
void |
setColorMatrix(Matrix3f m) 设置将应用于图像的每个单元格的颜色矩阵。 |
void |
setColorMatrix(Matrix4f m) 设置将应用于图像的每个单元格的颜色矩阵。 |
void |
setGreyscale() 设置一个颜色矩阵将RGB转换为亮度。 |
void |
setRGBtoYUV() 将矩阵设置为使用第四个通道的直接副本从RGB转换为YUV。 |
void |
setYUVtoRGB() 将矩阵设置为使用第四个通道的直接副本从YUV转换为RGB。 |
继承方法(Inherited methods) |
|
|---|---|
android.renderscript.Script
|
|
android.renderscript.BaseObj
|
|
java.lang.Object
|
|
ScriptIntrinsicColorMatrix create (RenderScript rs, Element e)
此方法在API级别19中已被弃用。
使用单参数版本,因为元素现在被忽略。
创建用于将颜色矩阵应用于分配的内在因素。
| 参数(Parameters) | |
|---|---|
rs |
RenderScript: The RenderScript context |
e |
Element: Element type for inputs and outputs, As of API 19, this parameter is ignored. The Element type check is performed in the kernel launch. |
| 返回(Returns) | |
|---|---|
ScriptIntrinsicColorMatrix |
ScriptIntrinsicColorMatrix |
ScriptIntrinsicColorMatrix create (RenderScript rs)
创建用于将颜色矩阵应用于分配的内在因素。
| 参数(Parameters) | |
|---|---|
rs |
RenderScript: The RenderScript context |
| 返回(Returns) | |
|---|---|
ScriptIntrinsicColorMatrix |
ScriptIntrinsicColorMatrix |
void forEach (Allocation ain, Allocation aout)
调用内核并将矩阵应用于输入Allocation每个单元并复制到输出Allocation 。 如果输入的向量大小小于4,则其余分量被视为矩阵乘的零。 如果输出矢量大小小于4,则丢弃未使用的矢量分量。
| 参数(Parameters) | |
|---|---|
ain |
Allocation: Input allocation |
aout |
Allocation: Output allocation |
void forEach (Allocation ain, Allocation aout, Script.LaunchOptions opt)
调用内核并将矩阵应用于输入Allocation每个单元并复制到输出Allocation 。 如果输入的向量大小小于4,则其余分量被视为矩阵乘的零。 如果输出矢量大小小于4,则丢弃未使用的矢量分量。
| 参数(Parameters) | |
|---|---|
ain |
Allocation: Input allocation |
aout |
Allocation: Output allocation |
opt |
Script.LaunchOptions: LaunchOptions for clipping |
Script.KernelID getKernelID ()
为此内核获取KernelID。
| 返回(Returns) | |
|---|---|
Script.KernelID |
Script.KernelID The KernelID object. |
void setAdd (float r,
float g,
float b,
float a)
设置应用颜色矩阵后要添加的值。 默认值是{0,0,0,0}
| 参数(Parameters) | |
|---|---|
r |
float: The red add value. |
g |
float: The green add value. |
b |
float: The blue add value. |
a |
float: The alpha add value. |
void setAdd (Float4 f)
设置应用颜色矩阵后要添加的值。 默认值是{0,0,0,0}
| 参数(Parameters) | |
|---|---|
f |
Float4: The float4 value to be added. |
void setColorMatrix (Matrix3f m)
设置将应用于图像的每个单元格的颜色矩阵。 这将设置alpha通道为副本。
| 参数(Parameters) | |
|---|---|
m |
Matrix3f: The 3x3 matrix to set. |
void setColorMatrix (Matrix4f m)
设置将应用于图像的每个单元格的颜色矩阵。
| 参数(Parameters) | |
|---|---|
m |
Matrix4f: The 4x4 matrix to set. |