# Brightness

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

*** ** * ** ***


```
@UnstableApi
public final class Brightness implements RgbMatrix
```

<br />

*** ** * ** ***

Modifies brightness of an input frame.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/effect/Brightness#Brightness(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = "-1", to = 1) float brightness)` Modifies brightness by adding a constant value to red, green, and blue values. |

| ### Public methods |
|---|---|
| `float[]` | `https://developer.android.com/reference/androidx/media3/effect/Brightness#getMatrix(long,boolean)(long presentationTimeUs, boolean useHdr)` Returns the 4x4 RGB transformation `https://developer.android.com/reference/android/opengl/Matrix.html` to apply to the color values of each pixel in the frame with the given timestamp. |
| `boolean` | `https://developer.android.com/reference/androidx/media3/effect/Brightness#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. |

| ### 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) |---|---| | `abstract https://developer.android.com/reference/androidx/media3/effect/GlShaderProgram` | `https://developer.android.com/reference/androidx/media3/effect/GlEffect#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. | |
| From [androidx.media3.effect.RgbMatrix](https://developer.android.com/reference/androidx/media3/effect/RgbMatrix) |---|---| | `https://developer.android.com/reference/androidx/media3/effect/BaseGlShaderProgram` | `https://developer.android.com/reference/androidx/media3/effect/RgbMatrix#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. | |

## Public constructors

### Brightness

```
public Brightness(@FloatRange(from = "-1", to = 1) float brightness)
```

Modifies brightness by adding a constant value to red, green, and blue values.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/FloatRange(from = "-1", to = 1) float brightness` | The constant value to add to red, green, and blue values. Should be greater than or equal to `-1f`, and less than or equal to `1f`. `0` means to leave brightness unchanged. |

## Public methods

### getMatrix

```
public float[] getMatrix(long presentationTimeUs, boolean useHdr)
```

Returns the 4x4 RGB transformation `https://developer.android.com/reference/android/opengl/Matrix.html` to apply to the color values of each pixel in the frame with the given timestamp.

| Parameters |
|---|---|
| `long presentationTimeUs` | The timestamp of the frame to apply the matrix on. |
| `boolean useHdr` | If `true`, colors will be in linear RGB BT.2020. If `false`, colors will be in linear RGB BT.709. Must be consistent with `useHdr` in `https://developer.android.com/reference/androidx/media3/effect/RgbMatrix#toGlShaderProgram(android.content.Context,boolean)`. |

| Returns |
|---|---|
| `float[]` | The `RgbMatrix` to apply to the frame. |

### isNoOp

```
public boolean isNoOp(int inputWidth, int inputHeight)
```

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

This can be used as a hint to skip this instance.

| Parameters |
|---|---|
| `int inputWidth` | The input frame width, in pixels. |
| `int inputHeight` | The input frame height, in pixels. |