capturable
Adds a capture-ability on the Composable which can draw Bitmap from the Composable component.
Example usage:
val captureController = rememberCaptureController()
val uiScope = rememberCoroutineScope()
// The content to be captured in to Bitmap
Column(
modifier = Modifier.capturable(captureController),
) {
// Composable content
}
Button(onClick = {
// Capture content
val bitmapAsync = captureController.captureAsync()
try {
val bitmap = bitmapAsync.await()
// Do something with `bitmap`.
} catch (error: Throwable) {
// Error occurred, do something.
}
}) { ... }
Content copied to clipboard
Parameters
controller
A CaptureController which gives control to capture the Composable content.