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

*** ** * ** ***

<br />

```
@UnstableApi
abstract class TextureOverlay
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` | Creates `https://developer.android.com/reference/kotlin/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/kotlin/androidx/media3/effect/CanvasOverlay), [DrawableOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/DrawableOverlay), [LottieOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/lottie/LottieOverlay), [TextOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextOverlay)

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

*** ** * ** ***

Creates overlays from OpenGL textures.

## Summary

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

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

## Public constructors

### TextureOverlay

```
TextureOverlay()
```

## Public functions

### configure

```
fun configure(videoSize: Size!): Unit
```

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 |
|---|---|
| `videoSize: https://developer.android.com/reference/kotlin/androidx/media3/common/util/Size!` | The width and height of the input video, in pixels. |

### getOverlaySettings

```
fun getOverlaySettings(presentationTimeUs: Long): OverlaySettings!
```

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

| Parameters |
|---|---|
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |

### getTextureId

```
abstract fun getTextureId(presentationTimeUs: Long): Int
```

Returns the overlay texture identifier displayed at the specified timestamp.

| Parameters |
|---|---|
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |

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

### getTextureSize

```
abstract fun getTextureSize(presentationTimeUs: Long): Size!
```

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/kotlin/androidx/media3/effect/TextureOverlay#getTextureId(long)`.

| Parameters |
|---|---|
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |

### getVertexTransformation

```
fun getVertexTransformation(presentationTimeUs: Long): Array<Float>!
```

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/kotlin/androidx/media3/effect/TextureOverlay#getOverlaySettings(long)`.

| Parameters |
|---|---|
| `presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The presentation timestamp of the current frame, in microseconds. |

### release

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

Releases all resources.

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