# SingleColorLut

Artifact: [androidx.media3:media3-effect](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/effect/SingleColorLut.java+class:androidx.media3.effect.SingleColorLut)

*** ** * ** ***

<br />

```
@UnstableApi
class SingleColorLut : ColorLut
```

<br />

*** ** * ** ***

Transforms the colors of a frame by applying the same color lookup table to each frame.

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#createFromBitmap(android.graphics.Bitmap)(lut: https://developer.android.com/reference/android/graphics/Bitmap.html!)` Creates a new instance. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#createFromCube(int[][][])(lutCube: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!>!>!)` Creates a new instance. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#getLength(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the length N of the 3D N x N x N LUT cube with the given timestamp. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#getLutTextureId(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Must be called after `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#toGlShaderProgram(android.content.Context,boolean)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#release()()` Releases the OpenGL texture of the LUT. |
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/BaseGlShaderProgram!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#toGlShaderProgram(android.content.Context,boolean)(context: https://developer.android.com/reference/android/content/Context.html!, useHdr: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns a `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram` that applies the effect. |

### Inherited functions

From [androidx.media3.common.Effect](https://developer.android.com/reference/kotlin/androidx/media3/common/Effect) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/common/Effect#getDurationAfterEffectApplied(long)(durationUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Returns the expected duration of the output stream when the effect is applied given a input `durationUs`.
From [androidx.media3.effect.GlEffect](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect#isNoOp(int,int)(inputWidth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, inputHeight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Returns whether a `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect` applies no change at every timestamp.

## Public functions

### createFromBitmap

```
java-static fun createFromBitmap(lut: Bitmap!): SingleColorLut!
```

Creates a new instance.

LUT needs to be a Bitmap of a flattened HALD image of width `N` and height ` N^2`. Each element must be an integer representing a color using the `https://developer.android.com/reference/android/graphics/Bitmap.Config.html#ARGB_8888` format.

### createFromCube

```
java-static fun createFromCube(lutCube: Array<Array<IntArray<Int>!>!>!): SingleColorLut!
```

Creates a new instance.

`lutCube` needs to be a `N x N x N` cube and each element is an integer representing a color using the `https://developer.android.com/reference/android/graphics/Bitmap.Config.html#ARGB_8888` format.

### getLength

```
fun getLength(presentationTimeUs: Long): Int
```

Returns the length N of the 3D N x N x N LUT cube with the given timestamp.

### getLutTextureId

```
fun getLutTextureId(presentationTimeUs: Long): Int
```

Must be called after `https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut#toGlShaderProgram(android.content.Context,boolean)`.

### release

```
fun release(): Unit
```

Releases the OpenGL texture of the LUT.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException` |   |

### toGlShaderProgram

```
fun toGlShaderProgram(context: Context!, useHdr: Boolean): BaseGlShaderProgram!
```

Returns a `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram` that applies the effect.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | A `https://developer.android.com/reference/android/content/Context.html`. |
| `useHdr: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether input textures come from an HDR source. If `true`, colors will be in linear RGB BT.2020. If `false`, colors will be in linear RGB BT.709. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while creating the `https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram`. |