CanvasFrontBufferedRenderer.Callback


public interface CanvasFrontBufferedRenderer.Callback<T extends Object>


Provides callbacks for consumers to draw into the front and multi buffered layers as well as provide opportunities to synchronize SurfaceControlCompat.Transactions to submit the layers to the hardware compositor.

Summary

Public methods

abstract void
@WorkerThread
onDrawFrontBufferedLayer(
    @NonNull Canvas canvas,
    int bufferWidth,
    int bufferHeight,
    @NonNull T param
)

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

abstract void
@WorkerThread
onDrawMultiBufferedLayer(
    @NonNull Canvas canvas,
    int bufferWidth,
    int bufferHeight,
    @NonNull Collection<@NonNull T> params
)

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

default void

Optional callback invoked when rendering to the front buffered layer is complete but before the buffers are submitted to the hardware compositor.

default void
@WorkerThread
onMultiBufferedLayerRenderComplete(
    @NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat multiBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat.Transaction transaction
)

Optional callback invoked when rendering to the multi buffered layer is complete but before the buffers are submitted to the hardware compositor.

Public methods

onDrawFrontBufferedLayer

Added in 1.0.2
@WorkerThread
abstract void onDrawFrontBufferedLayer(
    @NonNull Canvas canvas,
    int bufferWidth,
    int bufferHeight,
    @NonNull T param
)

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

Parameters
@NonNull Canvas canvas

Canvas used to issue drawing instructions into the front buffered layer

int bufferWidth

Width of the buffer that is being rendered into.

int bufferHeight

Height of the buffer that is being rendered into.

@NonNull T param

optional parameter provided the corresponding CanvasFrontBufferedRenderer.renderFrontBufferedLayer method that triggered this request to render into the front buffered layer

onDrawMultiBufferedLayer

@WorkerThread
abstract void onDrawMultiBufferedLayer(
    @NonNull Canvas canvas,
    int bufferWidth,
    int bufferHeight,
    @NonNull Collection<@NonNull T> params
)

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

Parameters
@NonNull Canvas canvas

Canvas used to issue drawing instructions into the front buffered layer

int bufferWidth

Width of the buffer that is being rendered into.

int bufferHeight

Height of the buffer that is being rendered into.

@NonNull Collection<@NonNull T> params

optional parameter provided to render the entire scene into the multi buffered layer. This is a collection of all parameters provided in consecutive invocations to CanvasFrontBufferedRenderer.renderFrontBufferedLayer since the last call to CanvasFrontBufferedRenderer.commit has been made. After CanvasFrontBufferedRenderer.commit is invoked, this collection is cleared and new parameters are added on each subsequent call to CanvasFrontBufferedRenderer.renderFrontBufferedLayer

onFrontBufferedLayerRenderComplete

Added in 1.0.2
@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 SurfaceControlCompat objects that maybe rendered within the scene.

Parameters
@NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl

Handle to the SurfaceControlCompat where the front buffered layer content is drawn. This can be used to configure various properties of the SurfaceControlCompat like z-ordering or visibility with the corresponding SurfaceControlCompat.Transaction.

@NonNull SurfaceControlCompat.Transaction transaction

Current SurfaceControlCompat.Transaction to apply updated buffered content to the front buffered layer.

onMultiBufferedLayerRenderComplete

Added in 1.0.2
@WorkerThread
default void onMultiBufferedLayerRenderComplete(
    @NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat multiBufferedLayerSurfaceControl,
    @NonNull SurfaceControlCompat.Transaction transaction
)

Optional callback invoked when rendering to the multi 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 SurfaceControlCompat objects that maybe rendered within the scene.

Parameters
@NonNull SurfaceControlCompat frontBufferedLayerSurfaceControl

Handle to the SurfaceControlCompat where the front buffered layer content is drawn. This can be used to configure various properties of the SurfaceControlCompat like z-ordering or visibility with the corresponding SurfaceControlCompat.Transaction.

@NonNull SurfaceControlCompat multiBufferedLayerSurfaceControl

Handle to the SurfaceControlCompat where the multi-buffered layer content is drawn. This can be used to configure various properties of the SurfaceControlCompat like z-ordering or visibility with the corresponding SurfaceControlCompat.Transaction.

@NonNull SurfaceControlCompat.Transaction transaction

Current SurfaceControlCompat.Transaction to apply updated buffered content to the multi buffered layer.