# BitmapOverlay

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

*** ** * ** ***

<br />

```
@UnstableApi
abstract class BitmapOverlay : TextureOverlay
```

<br />

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay) ||
|   | ↳ | [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay) |

Known direct subclasses [CanvasOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/CanvasOverlay), [DrawableOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/DrawableOverlay), [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/TextOverlay` | Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay` from text. |

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

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

*** ** * ** ***

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

Useful for overlaying images and animated images (e.g. GIFs).

## Summary

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

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap)(overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!)` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same position and size throughout the whole video. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap,androidx.media3.effect.StaticOverlaySettings)( overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!, overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings! )` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same `https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings` throughout the whole video. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.content.Context,android.net.Uri,androidx.media3.effect.StaticOverlaySettings)( context: https://developer.android.com/reference/android/content/Context.html!, overlayBitmapUri: https://developer.android.com/reference/android/net/Uri.html!, overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings! )` Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the input at `overlayBitmapUri` with the same `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video. |
| `abstract https://developer.android.com/reference/android/graphics/Bitmap.html!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#getBitmap(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the overlay bitmap displayed at the specified timestamp. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#getTextureId(long)(presentationTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Returns the overlay texture identifier displayed at the specified timestamp. |
| `https://developer.android.com/reference/kotlin/androidx/media3/common/util/Size!` | `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay#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/BitmapOverlay#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/BitmapOverlay#release()()` Releases all resources. |

### Inherited functions

From [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/kotlin/androidx/media3/effect/TextureOverlay) `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.

## Public constructors

### BitmapOverlay

```
BitmapOverlay()
```

## Public functions

### createStaticBitmapOverlay

```
java-static fun createStaticBitmapOverlay(overlayBitmap: Bitmap!): BitmapOverlay!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same position and size throughout the whole video.

| Parameters |
|---|---|
| `overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!` | The bitmap to overlay on the video. |

### createStaticBitmapOverlay

```
java-static fun createStaticBitmapOverlay(
    overlayBitmap: Bitmap!,
    overlaySettings: StaticOverlaySettings!
): BitmapOverlay!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same `https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings` throughout the whole video.

| Parameters |
|---|---|
| `overlayBitmap: https://developer.android.com/reference/android/graphics/Bitmap.html!` | The bitmap to overlay on the video. |
| `overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/OverlaySettings` configuring how the overlay is displayed on the frames. |

### createStaticBitmapOverlay

```
java-static fun createStaticBitmapOverlay(
    context: Context!,
    overlayBitmapUri: Uri!,
    overlaySettings: StaticOverlaySettings!
): BitmapOverlay!
```

Creates a `https://developer.android.com/reference/kotlin/androidx/media3/effect/BitmapOverlay` that shows the input at `overlayBitmapUri` with the same `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html`. |
| `overlayBitmapUri: https://developer.android.com/reference/android/net/Uri.html!` | The `https://developer.android.com/reference/android/net/Uri.html` pointing to the resource to be converted into a bitmap. |
| `overlaySettings: https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings!` | The `https://developer.android.com/reference/kotlin/androidx/media3/effect/StaticOverlaySettings` configuring how the overlay is displayed on the frames. |

### getBitmap

```
abstract fun getBitmap(presentationTimeUs: Long): Bitmap!
```

Returns the overlay bitmap 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. |

### getTextureId

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

```
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 #getTextureId(long).

Gets the width and height of the cached bitmap.

| 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 #getOverlaySettings overlay settings.

Flips the overlay vertically to convert between Android and OpenGL texture coordinate systems.

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