# 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
public final class SingleColorLut implements ColorLut
```

<br />

*** ** * ** ***

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

## Summary

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

### Inherited methods

From [androidx.media3.common.Effect](https://developer.android.com/reference/androidx/media3/common/Effect) `long` `https://developer.android.com/reference/androidx/media3/common/Effect#getDurationAfterEffectApplied(long)(long durationUs)`

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/androidx/media3/effect/GlEffect) `boolean` `https://developer.android.com/reference/androidx/media3/effect/GlEffect#isNoOp(int,int)(int inputWidth, int inputHeight)`

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

## Public methods

### createFromBitmap

```
public static SingleColorLut createFromBitmap(Bitmap lut)
```

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

```
public static SingleColorLut createFromCube(int[][][] lutCube)
```

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

```
public int getLength(long presentationTimeUs)
```

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

### getLutTextureId

```
public int getLutTextureId(long presentationTimeUs)
```

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

### release

```
public void release()
```

Releases the OpenGL texture of the LUT.

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

### toGlShaderProgram

```
public BaseGlShaderProgram toGlShaderProgram(Context context, boolean useHdr)
```

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

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