# DrawableOverlay

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

*** ** * ** ***

<br />

```
@UnstableApi
public abstract class DrawableOverlay extends BitmapOverlay
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.media3.effect.TextureOverlay](https://developer.android.com/reference/androidx/media3/effect/TextureOverlay) |||
|   | ↳ | [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay) ||
|   |   | ↳ | [androidx.media3.effect.DrawableOverlay](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`.

Uses a canvas to draw `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay` onto `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay`, which is then displayed on each frame.

## Summary

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

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay` | `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay#createStaticDrawableOverlay(android.graphics.drawable.Drawable,androidx.media3.effect.StaticOverlaySettings)( https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable, https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings )` Creates a `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay` that shows the `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` with the same `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings` throughout the whole video. |
| `https://developer.android.com/reference/android/graphics/Bitmap.html` | `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay#getBitmap(long)(long presentationTimeUs)` Returns the overlay bitmap displayed at the specified timestamp. |
| `abstract https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay#getDrawable(long)(long presentationTimeUs)` Returns the overlay `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` displayed at the specified timestamp. |

### Inherited methods

From [androidx.media3.effect.BitmapOverlay](https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay) `static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap)(https://developer.android.com/reference/android/graphics/Bitmap.html overlayBitmap)`

Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same position and size throughout the whole video.
`static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.graphics.Bitmap,androidx.media3.effect.StaticOverlaySettings)(

https://developer.android.com/reference/android/graphics/Bitmap.html overlayBitmap,

https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings

)`

Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the `overlayBitmap` in the same `https://developer.android.com/reference/androidx/media3/common/OverlaySettings` throughout the whole video.
`static https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#createStaticBitmapOverlay(android.content.Context,android.net.Uri,androidx.media3.effect.StaticOverlaySettings)(

https://developer.android.com/reference/android/content/Context.html context,

https://developer.android.com/reference/android/net/Uri.html overlayBitmapUri,

https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings

)`

Creates a `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay` that shows the input at `overlayBitmapUri` with the same `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.
`int` `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#getTextureId(long)(long presentationTimeUs)`

Returns the overlay texture identifier displayed at the specified timestamp.
`https://developer.android.com/reference/androidx/media3/common/util/Size` `https://developer.android.com/reference/androidx/media3/effect/BitmapOverlay#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/BitmapOverlay#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/BitmapOverlay#release()()`

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

## Public constructors

### DrawableOverlay

```
public DrawableOverlay()
```

## Public methods

### createStaticDrawableOverlay

```
public static DrawableOverlay createStaticDrawableOverlay(
    Drawable drawable,
    StaticOverlaySettings overlaySettings
)
```

Creates a `https://developer.android.com/reference/androidx/media3/effect/DrawableOverlay` that shows the `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` with the same `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings` throughout the whole video.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html drawable` | The `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` to be displayed. |
| `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings overlaySettings` | The `https://developer.android.com/reference/androidx/media3/effect/StaticOverlaySettings` configuring how the overlay is displayed on the frames. |

### getBitmap

```
public Bitmap getBitmap(long presentationTimeUs)
```

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

### getDrawable

```
public abstract Drawable getDrawable(long presentationTimeUs)
```

Returns the overlay `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` displayed at the specified timestamp.

The drawable must have its bounds set via `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setBounds(android.graphics.Rect)` for drawable to be displayed on the frame.

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