Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/graphics/RuntimeXfermode#pubctors) \| [Methods](https://developer.android.com/reference/android/graphics/RuntimeXfermode#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/RuntimeXfermode#inhmethods)

# RuntimeXfermode

*** ** * ** ***

` public class RuntimeXfermode `   
` ` ` extends https://developer.android.com/reference/android/graphics/Xfermode ` ` `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.graphics.Xfermode](https://developer.android.com/reference/android/graphics/Xfermode) ||
|   | ↳ | android.graphics.RuntimeXfermode |

<br />

*** ** * ** ***

<br />

A `https://developer.android.com/reference/android/graphics/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);
```

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#RuntimeXfermode(java.lang.String)(https://developer.android.com/reference/java/lang/String agsl) ` Creates a new RuntimeBlender. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setColorUniform(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int color) ` Sets the uniform color value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setColorUniform(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String uniformName, long color) ` Sets the uniform color value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setColorUniform(java.lang.String,%20android.graphics.Color)(https://developer.android.com/reference/java/lang/String uniformName, https://developer.android.com/reference/android/graphics/Color color) ` Sets the uniform color value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setFloatUniform(java.lang.String,%20float[])(https://developer.android.com/reference/java/lang/String uniformName, float[] values) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setFloatUniform(java.lang.String,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setFloatUniform(java.lang.String,%20float,%20float,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2, float value3, float value4) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setFloatUniform(java.lang.String,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setFloatUniform(java.lang.String,%20float,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2, float value3) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setInputColorFilter(java.lang.String,%20android.graphics.ColorFilter)(https://developer.android.com/reference/java/lang/String filterName, https://developer.android.com/reference/android/graphics/ColorFilter colorFilter) ` Assigns the uniform color filter to the provided color filter parameter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setInputShader(java.lang.String,%20android.graphics.Shader)(https://developer.android.com/reference/java/lang/String shaderName, https://developer.android.com/reference/android/graphics/Shader shader) ` Assigns the uniform shader to the provided shader parameter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setInputXfermode(java.lang.String,%20android.graphics.RuntimeXfermode)(https://developer.android.com/reference/java/lang/String xfermodeName, https://developer.android.com/reference/android/graphics/RuntimeXfermode xfermode) ` Assigns the uniform xfermode to the provided xfermode parameter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setIntUniform(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setIntUniform(java.lang.String,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2, int value3) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setIntUniform(java.lang.String,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2, int value3, int value4) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setIntUniform(java.lang.String,%20int[])(https://developer.android.com/reference/java/lang/String uniformName, int[] values) ` Sets the uniform value corresponding to this color filter. |
| ` void` | ` https://developer.android.com/reference/android/graphics/RuntimeXfermode#setIntUniform(java.lang.String,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2) ` Sets the uniform value corresponding to this color filter. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### RuntimeXfermode

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public RuntimeXfermode (String agsl)
```

Creates a new RuntimeBlender.

<br />

| Parameters ||
|---|---|
| `agsl` | `String`: The text of AGSL color filter program to run. This value cannot be `null`. <br /> |

## Public methods

### setColorUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `color` | `int`: the provided sRGB color <br /> |

### setColorUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `color` | `long`: the provided sRGB color <br /> |

### setColorUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `color` | `Color`: the provided sRGB color. This value cannot be `null`. <br /> |

### setFloatUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `values` | `float`: This value cannot be `null`. <br /> |

### setFloatUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value` | `float` <br /> |

### setFloatUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `float` <br /> |
| `value2` | `float` <br /> |
| `value3` | `float` <br /> |
| `value4` | `float` <br /> |

### setFloatUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `float` <br /> |
| `value2` | `float` <br /> |

### setFloatUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `float` <br /> |
| `value2` | `float` <br /> |
| `value3` | `float` <br /> |

### setInputColorFilter

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `filterName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `colorFilter` | `ColorFilter`: filter passed into the AGSL program for sampling. This value cannot be `null`. <br /> |

### setInputShader

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `shaderName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `shader` | `Shader`: shader passed into the AGSL program for sampling. This value cannot be `null`. <br /> |

### setInputXfermode

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `xfermodeName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `xfermode` | `RuntimeXfermode`: xfermode function passed into the AGSL program for sampling. This value cannot be `null`. <br /> |

### setIntUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value` | `int` <br /> |

### setIntUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `int` <br /> |
| `value2` | `int` <br /> |
| `value3` | `int` <br /> |

### setIntUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `int` <br /> |
| `value2` | `int` <br /> |
| `value3` | `int` <br /> |
| `value4` | `int` <br /> |

### setIntUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `values` | `int`: This value cannot be `null`. <br /> |

### setIntUniform

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the uniform declared in the AGSL program. This value cannot be `null`. <br /> |
| `value1` | `int` <br /> |
| `value2` | `int` <br /> |