The Developer Preview for Android 11 is now available; test it out and share your feedback.

PictureRecorder

class PictureRecorder
kotlin.Any
   ↳ androidx.ui.graphics.PictureRecorder

Creates a new idle PictureRecorder. To associate it with a Canvas and begin recording, pass this PictureRecorder to the Canvas constructor.

Summary

Public constructors

Creates a new idle PictureRecorder.

Public methods

Picture

Finishes recording graphical operations.

Inherited extension functions

From androidx.compose
operator T

IMPORTANT: This global operator is TEMPORARY, and should be removed whenever an answer for contextual composers is reached.

Properties

Boolean

Whether this object is currently recording commands.

Public constructors

<init>

PictureRecorder()

Creates a new idle PictureRecorder. To associate it with a Canvas and begin recording, pass this PictureRecorder to the Canvas constructor.

Public methods

endRecording

fun endRecording(): Picture

Finishes recording graphical operations.

Returns a picture containing the graphical operations that have been recorded thus far. After calling this function, both the picture recorder and the canvas objects are invalid and cannot be used further.

Returns null if the PictureRecorder is not associated with a canvas.

Properties

isRecording

val isRecording: Boolean

Whether this object is currently recording commands.

Specifically, this returns true if a Canvas object has been created to record commands and recording has not yet ended via a call to endRecording, and false if either this PictureRecorder has not yet been associated with a Canvas, or the endRecording method has already been called.