# TextureOverlay

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

*** ** * ** ***


```
@UnstableApi
public abstract class TextureOverlay
```

<br />

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

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` | Creates `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay`s from `https://developer.android.com/reference/android/graphics/Bitmap.html`s. |

Known indirect subclasses [CanvasOverlay](https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay), [DrawableOverlay](https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay), [LottieOverlay](https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay), [TextOverlay](https://developer.android.com/reference/androidx/media3/effect/TextOverlay)

|---|---|
| `https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay` | A `https://developer.android.com/reference/androidx/media3/effect/TextOverlay` that is backed by a `https://developer.android.com/reference/android/graphics/Canvas.html`. |
| `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay` | Creates a `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay` from `https://developer.android.com/reference/android/graphics/drawable/Drawable.html`. |
| `https://developer.android.com/reference/androidx/media3/effect/lottie/LottieOverlay` | A `https://developer.android.com/reference/androidx/media3/effect/CanvasOverlay` that renders a Lottie animation. |
| `https://developer.android.com/reference/androidx/media3/effect/TextOverlay` | Creates a `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay` from text. |

*** ** * ** ***

Creates overlays from OpenGL textures.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#TextureOverlay()()` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#configure(androidx.media3.common.util.Size)(https://developer.android.com/reference/androidx/media3/common/util/Size videoSize)` Set up resources for the overlay given the input video's dimensions. |
| `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getOverlaySettings(long)(long presentationTimeUs)` Returns the `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` controlling how the overlay is displayed at the specified timestamp. |
| `abstract int` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getTextureId(long)(long presentationTimeUs)` Returns the overlay texture identifier displayed at the specified timestamp. |
| `abstract https://developer.android.com/reference/androidx/media3/common/util/Size` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getTextureSize(long)(long presentationTimeUs)` Returns the pixel width and height of the overlay texture displayed at the specified timestamp. |
| `float[]` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getVertexTransformation(long)(long presentationTimeUs)` Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp. |
| `void` | `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#release()()` Releases all resources. |

## Public constructors

### TextureOverlay

```
public TextureOverlay()
```

## Public methods

### configure

```
public void configure(Size videoSize)
```

Set up resources for the overlay given the input video's dimensions.

This method will be called before drawing the first frame and before drawing subsequent frames with different input dimensions.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/util/Size videoSize` | The width and height of the input video, in pixels. |

### getOverlaySettings

```
public OverlaySettings getOverlaySettings(long presentationTimeUs)
```

Returns the `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` controlling how the overlay is displayed at the specified timestamp.

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation timestamp of the current frame, in microseconds. |

### getTextureId

```
public abstract int getTextureId(long presentationTimeUs)
```

Returns the overlay texture identifier displayed at the specified timestamp.

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation timestamp of the current frame, in microseconds. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while processing or drawing the frame. |

### getTextureSize

```
public abstract Size getTextureSize(long presentationTimeUs)
```

Returns the pixel width and height of the overlay texture displayed at the specified timestamp.

This method must be called after `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getTextureId(long)`.

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation timestamp of the current frame, in microseconds. |

### getVertexTransformation

```
public float[] getVertexTransformation(long presentationTimeUs)
```

Returns a 4x4 OpenGL matrix, controlling how the vertices of the overlay are displayed at the specified timestamp.

Applied before `https://developer.android.com/reference/androidx/media3/effect/TextureOverlay#getOverlaySettings(long)`.

| Parameters |
|---|---|
| `long presentationTimeUs` | The presentation timestamp of the current frame, in microseconds. |

### release

```
public void release()
```

Releases all resources.

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException` | If an error occurs while releasing resources. |