RuntimeXfermode
public
class
RuntimeXfermode
extends Xfermode
| java.lang.Object | ||
| ↳ | 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 | |
|---|---|
RuntimeXfermode(String agsl)
Creates a new RuntimeBlender. |
|
Public methods | |
|---|---|
void
|
setColorUniform(String uniformName, int color)
Sets the uniform color value corresponding to this color filter. |
void
|
setColorUniform(String uniformName, long color)
Sets the uniform color value corresponding to this color filter. |
void
|
setColorUniform(String uniformName, Color color)
Sets the uniform color value corresponding to this color filter. |
void
|
setFloatUniform(String uniformName, float[] values)
Sets the uniform value corresponding to this color filter. |
void
|
setFloatUniform(String uniformName, float value)
Sets the uniform value corresponding to this color filter. |
void
|
setFloatUniform(String uniformName, float value1, float value2, float value3, float value4)
Sets the uniform value corresponding to this color filter. |
void
|
setFloatUniform(String uniformName, float value1, float value2)
Sets the uniform value corresponding to this color filter. |
void
|
setFloatUniform(String uniformName, float value1, float value2, float value3)
Sets the uniform value corresponding to this color filter. |
void
|
setInputColorFilter(String filterName, ColorFilter colorFilter)
Assigns the uniform color filter to the provided color filter parameter. |
void
|
setInputShader(String shaderName, Shader shader)
Assigns the uniform shader to the provided shader parameter. |
void
|
setInputXfermode(String xfermodeName, RuntimeXfermode xfermode)
Assigns the uniform xfermode to the provided xfermode parameter. |
void
|
setIntUniform(String uniformName, int value)
Sets the uniform value corresponding to this color filter. |
void
|
setIntUniform(String uniformName, int value1, int value2, int value3)
Sets the uniform value corresponding to this color filter. |
void
|
setIntUniform(String uniformName, int value1, int value2, int value3, int value4)
Sets the uniform value corresponding to this color filter. |
void
|
setIntUniform(String uniformName, int[] values)
Sets the uniform value corresponding to this color filter. |
void
|
setIntUniform(String uniformName, int value1, int value2)
Sets the uniform value corresponding to this color filter. |
Inherited methods | |
|---|---|
Public constructors
RuntimeXfermode
public RuntimeXfermode (String agsl)
Creates a new RuntimeBlender.
| Parameters | |
|---|---|
agsl |
String: The text of AGSL color filter program to run.
This value cannot be null. |
Public methods
setColorUniform
public void setColorUniform (String uniformName, int color)
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
public void setColorUniform (String uniformName, long color)
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 |
setColorUniform
public void setColorUniform (String uniformName, Color color)
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. |
setFloatUniform
public void setFloatUniform (String uniformName, float[] values)
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 |
float: This value cannot be null. |
setFloatUniform
public void setFloatUniform (String uniformName, float value)
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. |
value |
float |
setFloatUniform
public void setFloatUniform (String uniformName, float value1, float value2, float value3, float value4)
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. |
value1 |
float |
value2 |
float |
value3 |
float |
value4 |
float |
setFloatUniform
public void setFloatUniform (String uniformName, float value1, float value2)
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. |
value1 |
float |
value2 |
float |
setFloatUniform
public void setFloatUniform (String uniformName, float value1, float value2, float value3)
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. |
value1 |
float |
value2 |
float |
value3 |
float |
setInputColorFilter
public void setInputColorFilter (String filterName, ColorFilter colorFilter)
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
public void setInputShader (String shaderName, Shader shader)
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
public void setInputXfermode (String xfermodeName, RuntimeXfermode xfermode)
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
public void setIntUniform (String uniformName, int value)
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. |
value |
int |
setIntUniform
public void setIntUniform (String uniformName, int value1, int value2, int value3)
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. |
value1 |
int |
value2 |
int |
value3 |
int |
setIntUniform
public void setIntUniform (String uniformName, int value1, int value2, int value3, int value4)
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. |
value1 |
int |
value2 |
int |
value3 |
int |
value4 |
int |
setIntUniform
public void setIntUniform (String uniformName, int[] values)
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 |
int: This value cannot be null. |
setIntUniform
public void setIntUniform (String uniformName, int value1, int value2)
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. |
value1 |
int |
value2 |
int |