# LowLatencyCanvasView.Callback

Artifact: [androidx.graphics:graphics-core](https://developer.android.com/jetpack/androidx/releases/graphics) [View Source](https://cs.android.com/search?q=file:androidx/graphics/lowlatency/LowLatencyCanvasView.kt+class:androidx.graphics.lowlatency.LowLatencyCanvasView.Callback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

*** ** * ** ***


```
public interface LowLatencyCanvasView.Callback
```

<br />

*** ** * ** ***

Provides callbacks for consumers to draw into the front buffered overlay as well as provide opportunities to synchronize `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat.Transaction`s to submit the layers to the hardware compositor

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/graphics/lowlatency/LowLatencyCanvasView.Callback#onDrawFrontBufferedLayer(android.graphics.Canvas,kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, int width, int height)` Callback invoked to render content into the front buffered layer with the specified parameters. |
| `default void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/graphics/lowlatency/LowLatencyCanvasView.Callback#onFrontBufferedLayerRenderComplete(androidx.graphics.surface.SurfaceControlCompat,androidx.graphics.surface.SurfaceControlCompat.Transaction)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat frontBufferedLayerSurfaceControl, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat.Transaction transaction )` Optional callback invoked when rendering to the front buffered layer is complete but before the buffers are submitted to the hardware compositor. |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread https://developer.android.com/reference/androidx/graphics/lowlatency/LowLatencyCanvasView.Callback#onRedrawRequested(android.graphics.Canvas,kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas, int width, int height)` Callback invoked when the entire scene should be re-rendered. |

## Public methods

### onDrawFrontBufferedLayer

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@WorkerThread
abstract void onDrawFrontBufferedLayer(@NonNull Canvas canvas, int width, int height)
```

Callback invoked to render content into the front buffered layer with the specified parameters.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | `https://developer.android.com/reference/android/graphics/Canvas.html` used to issue drawing instructions into the front buffered layer |
| `int width` | Logical width of the content that is being rendered. |
| `int height` | Logical height of the content that is being rendered. |

### onFrontBufferedLayerRenderComplete

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@WorkerThread
default void onFrontBufferedLayerRenderComplete(
    @NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat.Transaction transaction
)
```

Optional callback invoked when rendering to the front buffered layer is complete but before the buffers are submitted to the hardware compositor. This provides consumers a mechanism for synchronizing the transaction with other `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat` objects that maybe rendered within the scene.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat frontBufferedLayerSurfaceControl` | Handle to the `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat` where the front buffered layer content is drawn. This can be used to configure various properties of the `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat` like z-ordering or visibility with the corresponding `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat.Transaction`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat.Transaction transaction` | Current `https://developer.android.com/reference/androidx/graphics/surface/SurfaceControlCompat.Transaction` to apply updated buffered content to the front buffered layer. |

### onRedrawRequested

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/graphics#1.0.0)

```
@WorkerThread
abstract void onRedrawRequested(@NonNull Canvas canvas, int width, int height)
```

Callback invoked when the entire scene should be re-rendered. This is invoked during initialization and when the corresponding Activity is resumed from a background state.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Canvas.html canvas` | `https://developer.android.com/reference/android/graphics/Canvas.html` used to issue drawing instructions into the front buffered layer |
| `int width` | Logical width of the content that is being rendered. |
| `int height` | Logical height of the content that is being rendered. |