RuntimeXfermode


open class RuntimeXfermode : Xfermode
kotlin.Any
   ↳ android.graphics.Xfermode
   ↳ android.graphics.RuntimeXfermode

A RuntimeXfermode calculates a per-pixel color based on the output of a user * defined Android Graphics Shading Language (AGSL) function.

This AGSL function takes in two input colors to be operated on. These colors are in sRGB * and the output is also interpreted as sRGB. The AGSL function signature expects a single input * of color (packed as a half4 or float4 or vec4).

vec4 main(half4 src, half4 dst);
  

Summary

Public constructors

Creates a new RuntimeBlender.

Public methods
open Unit
setColorUniform(uniformName: String, color: Color)

Sets the uniform color value corresponding to this color filter.

open Unit
setColorUniform(uniformName: String, color: Int)

Sets the uniform color value corresponding to this color filter.

open Unit
setColorUniform(uniformName: String, color: Long)

Sets the uniform color value corresponding to this color filter.

open Unit
setFloatUniform(uniformName: String, value: Float)

Sets the uniform value corresponding to this color filter.

open Unit
setFloatUniform(uniformName: String, value1: Float, value2: Float)

Sets the uniform value corresponding to this color filter.

open Unit
setFloatUniform(uniformName: String, value1: Float, value2: Float, value3: Float)

Sets the uniform value corresponding to this color filter.

open Unit
setFloatUniform(uniformName: String, value1: Float, value2: Float, value3: Float, value4: Float)

Sets the uniform value corresponding to this color filter.

open Unit
setFloatUniform(uniformName: String, values: FloatArray)

Sets the uniform value corresponding to this color filter.

open Unit
setInputColorFilter(filterName: String, colorFilter: ColorFilter)

Assigns the uniform color filter to the provided color filter parameter.

open Unit
setInputShader(shaderName: String, shader: Shader)

Assigns the uniform shader to the provided shader parameter.

open Unit
setInputXfermode(xfermodeName: String, xfermode: RuntimeXfermode)

Assigns the uniform xfermode to the provided xfermode parameter.

open Unit
setIntUniform(uniformName: String, value: Int)

Sets the uniform value corresponding to this color filter.

open Unit
setIntUniform(uniformName: String, value1: Int, value2: Int)

Sets the uniform value corresponding to this color filter.

open Unit
setIntUniform(uniformName: String, value1: Int, value2: Int, value3: Int)

Sets the uniform value corresponding to this color filter.

open Unit
setIntUniform(uniformName: String, value1: Int, value2: Int, value3: Int, value4: Int)

Sets the uniform value corresponding to this color filter.

open Unit
setIntUniform(uniformName: String, values: IntArray)

Sets the uniform value corresponding to this color filter.

Public constructors

RuntimeXfermode

RuntimeXfermode(agsl: String)

Creates a new RuntimeBlender.

Parameters
agsl String: The text of AGSL color filter program to run. This value cannot be null.

Public methods

setColorUniform

open fun setColorUniform(
    uniformName: String,
    color: Color
): Unit

Sets the uniform color value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the color uniform declared in the AGSL program This value cannot be null.
color Color: the provided sRGB color This value cannot be null.

setColorUniform

open fun setColorUniform(
    uniformName: String,
    color: Int
): Unit

Sets the uniform color value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the color uniform declared in the AGSL program This value cannot be null.
color Int: the provided sRGB color

setColorUniform

open fun setColorUniform(
    uniformName: String,
    color: Long
): Unit

Sets the uniform color value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the color uniform declared in the AGSL program This value cannot be null.
color Long: the provided sRGB color

setFloatUniform

open fun setFloatUniform(
    uniformName: String,
    value: Float
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than a float or float[1] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setFloatUniform

open fun setFloatUniform(
    uniformName: String,
    value1: Float,
    value2: Float
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than a vec2 or float[2] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setFloatUniform

open fun setFloatUniform(
    uniformName: String,
    value1: Float,
    value2: Float,
    value3: Float
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than a vec3 or float[3] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setFloatUniform

open fun setFloatUniform(
    uniformName: String,
    value1: Float,
    value2: Float,
    value3: Float,
    value4: Float
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than a vec4 or float[4] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setFloatUniform

open fun setFloatUniform(
    uniformName: String,
    values: FloatArray
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than a float (for N=1), vecN, or float[N] where N is the length of the values param then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.
values FloatArray: This value cannot be null.

setInputColorFilter

open fun setInputColorFilter(
    filterName: String,
    colorFilter: ColorFilter
): Unit

Assigns the uniform color filter to the provided color filter parameter. If the shader program does not have a uniform color filter with that name then an IllegalArgumentException is thrown.

Parameters
filterName String: name matching the uniform declared in the AGSL program This value cannot be null.
colorFilter ColorFilter: filter passed into the AGSL program for sampling This value cannot be null.

setInputShader

open fun setInputShader(
    shaderName: String,
    shader: Shader
): Unit

Assigns the uniform shader to the provided shader parameter. If the shader program does not have a uniform shader with that name then an IllegalArgumentException is thrown.

Parameters
shaderName String: name matching the uniform declared in the AGSL program This value cannot be null.
shader Shader: shader passed into the AGSL program for sampling This value cannot be null.

setInputXfermode

open fun setInputXfermode(
    xfermodeName: String,
    xfermode: RuntimeXfermode
): Unit

Assigns the uniform xfermode to the provided xfermode parameter. If the shader program does not have a uniform xfermode with that name then an IllegalArgumentException is thrown.

Parameters
xfermodeName String: name matching the uniform declared in the AGSL program This value cannot be null.
xfermode RuntimeXfermode: xfermode function passed into the AGSL program for sampling This value cannot be null.

setIntUniform

open fun setIntUniform(
    uniformName: String,
    value: Int
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than an int or int[1] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setIntUniform

open fun setIntUniform(
    uniformName: String,
    value1: Int,
    value2: Int
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than an ivec2 or int[2] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setIntUniform

open fun setIntUniform(
    uniformName: String,
    value1: Int,
    value2: Int,
    value3: Int
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than an ivec3 or int[3] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setIntUniform

open fun setIntUniform(
    uniformName: String,
    value1: Int,
    value2: Int,
    value3: Int,
    value4: Int
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than an ivec4 or int[4] then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.

setIntUniform

open fun setIntUniform(
    uniformName: String,
    values: IntArray
): Unit

Sets the uniform value corresponding to this color filter. If the effect does not have a uniform with that name or if the uniform is declared with a type other than an int (for N=1), ivecN, or int[N] where N is the length of the values param then an IllegalArgumentException is thrown.

Parameters
uniformName String: name matching the uniform declared in the AGSL program This value cannot be null.
values IntArray: This value cannot be null.