# ColorLut

# ColorLut

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/ColorLut.java+class:androidx.media3.effect.ColorLut)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/effect/ColorLut "View this page in Java")

<br />

```
@UnstableApi
interface ColorLut : GlEffect
```

<br />

Known direct subclasses  
[SingleColorLut](https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut)  

|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| [SingleColorLut](https://developer.android.com/reference/kotlin/androidx/media3/effect/SingleColorLut) | Transforms the colors of a frame by applying the same color lookup table to each frame. |

*** ** * ** ***

Specifies color transformations using color lookup tables to apply to each frame in the fragment shader.

## Summary

|                                            ### Public functions                                             |
|-------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                 | [getLength](https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorLut#getLength(long))`(presentationTimeUs: `[Long](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.                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                 | [getLutTextureId](https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorLut#getLutTextureId(long))`(presentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Returns the OpenGL texture ID of the LUT to apply to the pixels of the frame with the given timestamp.                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                               | [release](https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorLut#release())`()` Releases the OpenGL texture of the LUT.                                                                                                                                                                                                                                                                                                                                                |
| [GlShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram)`!` | [toGlShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/ColorLut#toGlShaderProgram(android.content.Context,boolean))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!, useHdr: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` Returns a[GlShaderProgram](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) |-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [getDurationAfterEffectApplied](https://developer.android.com/reference/kotlin/androidx/media3/common/Effect#getDurationAfterEffectApplied(long))`(durationUs: `[Long](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) |-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isNoOp](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect#isNoOp(int,int))`(inputWidth: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, inputHeight: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns whether a[GlEffect](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlEffect)applies no change at every timestamp. | |

## Public functions

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

Returns the OpenGL texture ID of the LUT to apply to the pixels of the frame with the given timestamp.  

### release

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

Releases the OpenGL texture of the LUT.  

|                                                                     Throws                                                                      |
|-------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [androidx.media3.common.util.GlUtil.GlException](https://developer.android.com/reference/kotlin/androidx/media3/common/util/GlUtil.GlException) |   |

### toGlShaderProgram

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

Returns a[GlShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram)that applies the effect.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!` | A[Context](https://developer.android.com/reference/android/content/Context.html).                                                               |
| `useHdr: `[Boolean](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                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
| [androidx.media3.common.VideoFrameProcessingException](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessingException) | If an error occurs while creating the[GlShaderProgram](https://developer.android.com/reference/kotlin/androidx/media3/effect/GlShaderProgram). |