Skip to content

Most visited

Recently visited

navigation

ScriptIntrinsicColorMatrix

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


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(long 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, Script.LaunchOptions opt)

Invoke the kernel and apply the matrix to each cell of input Allocation and copy to the output 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 setAdd(Float4 f)

Set the value to be added after the color matrix has been applied.

void setAdd(float r, float g, float b, float a)

Set the value to be added after the color matrix has been applied.

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.

Inherited methods

From class android.support.v8.renderscript.Script
From class android.support.v8.renderscript.BaseObj
From class java.lang.Object

Protected constructors

ScriptIntrinsicColorMatrix

added in version 23.0.0
ScriptIntrinsicColorMatrix (long id, 
                RenderScript rs)

Parameters
id long

rs RenderScript

Public methods

create

added in version 23.0.0
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 RenderScript: The RenderScript context

e Element: Element type for intputs and outputs

Returns
ScriptIntrinsicColorMatrix ScriptIntrinsicColorMatrix

forEach

added in version 23.0.0
void forEach (Allocation ain, 
                Allocation aout, 
                Script.LaunchOptions opt)

Invoke the kernel and apply the matrix to each cell of input Allocation and copy to the output Allocation. If the vector size of the input is less than four, the remaining components are treated as zero for the matrix multiply. If the output vector size is less than four, the unused vector components are discarded.

Parameters
ain Allocation: Input allocation

aout Allocation: Output allocation

opt Script.LaunchOptions: LaunchOptions for clipping

forEach

added in version 23.0.0
void forEach (Allocation ain, 
                Allocation aout)

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

Parameters
ain Allocation: Input allocation

aout Allocation: Output allocation

getKernelID

added in version 23.0.0
Script.KernelID getKernelID ()

Get a KernelID for this intrinsic kernel.

Returns
Script.KernelID Script.KernelID The KernelID object.

setAdd

added in version 23.0.0
void setAdd (Float4 f)

Set the value to be added after the color matrix has been applied. The default value is {0, 0, 0, 0}

Parameters
f Float4: The float4 value to be added.

setAdd

added in version 23.0.0
void setAdd (float r, 
                float g, 
                float b, 
                float a)

Set the value to be added after the color matrix has been applied. The default value is {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.

setColorMatrix

added in version 23.0.0
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 Matrix3f: The 3x3 matrix to set.

setColorMatrix

added in version 23.0.0
void setColorMatrix (Matrix4f m)

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

Parameters
m Matrix4f: The 4x4 matrix to set.

setGreyscale

added in version 23.0.0
void setGreyscale ()

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

setRGBtoYUV

added in version 23.0.0
void setRGBtoYUV ()

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

setYUVtoRGB

added in version 23.0.0
void setYUVtoRGB ()

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

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.