to top
Android APIs
public class

ScriptIntrinsicColorMatrix

extends ScriptIntrinsic
java.lang.Object
   ↳ android.support.v8.renderscript.BaseObj
     ↳ android.support.v8.renderscript.Script
       ↳ android.support.v8.renderscript.ScriptIntrinsic
         ↳ android.support.v8.renderscript.ScriptIntrinsicColorMatrix

Class Overview

Intrinsic for applying a color matrix to allocations. This has the same effect as loading each element and converting it to a F32_4(RenderScript), multiplying the result by the 4x4 color matrix as performed by rsMatrixMultiply() and writing it to the output after conversion back to U8_4(RenderScript).

Summary

Protected Constructors
ScriptIntrinsicColorMatrix(int id, RenderScript rs)
Public Methods
static ScriptIntrinsicColorMatrix create(RenderScript rs, Element e)
Create an intrinsic for applying a color matrix to an allocation.
void forEach(Allocation ain, Allocation aout)
Invoke the kernel and apply the matrix to each cell of ain and copy to aout.
Script.KernelID getKernelID()
Get a KernelID for this intrinsic kernel.
void setColorMatrix(Matrix3f m)
Set the color matrix which will be applied to each cell of the image.
void setColorMatrix(Matrix4f m)
Set the color matrix which will be applied to each cell of the image.
void setGreyscale()
Set a color matrix to convert from RGB to luminance.
void setRGBtoYUV()
Set the matrix to convert from RGB to YUV with a direct copy of the 4th channel.
void setYUVtoRGB()
Set the matrix to convert from YUV to RGB with a direct copy of the 4th channel.
[Expand]
Inherited Methods
From class android.support.v8.renderscript.Script
From class android.support.v8.renderscript.BaseObj
From class java.lang.Object

Protected Constructors

protected ScriptIntrinsicColorMatrix (int id, RenderScript rs)

Public Methods

public static ScriptIntrinsicColorMatrix create (RenderScript rs, Element e)

Create an intrinsic for applying a color matrix to an allocation. Supported elements types are U8_4(RenderScript)

Parameters
rs The RenderScript context
e Element type for intputs and outputs
Returns
  • ScriptIntrinsicColorMatrix

public void forEach (Allocation ain, Allocation aout)

Invoke the kernel and apply the matrix to each cell of ain and copy to aout.

Parameters
ain Input allocation
aout Output allocation

public Script.KernelID getKernelID ()

Get a KernelID for this intrinsic kernel.

Returns
  • Script.KernelID The KernelID object.

public void setColorMatrix (Matrix3f m)

Set the color matrix which will be applied to each cell of the image. This will set the alpha channel to be a copy.

Parameters
m The 3x3 matrix to set.

public void setColorMatrix (Matrix4f m)

Set the color matrix which will be applied to each cell of the image.

Parameters
m The 4x4 matrix to set.

public void setGreyscale ()

Set a color matrix to convert from RGB to luminance. The alpha channel will be a copy.

public void setRGBtoYUV ()

Set the matrix to convert from RGB to YUV with a direct copy of the 4th channel.

public void setYUVtoRGB ()

Set the matrix to convert from YUV to RGB with a direct copy of the 4th channel.