drawToBitmap

fun drawToBitmap(bitmap: Bitmap, density: Density, size: Size, onDraw: DrawScope.() -> Unit)

Render an element normally drawn within a Compose Canvas into a Bitmap.

This allows shared elements between the app and tiles.

Parameters

bitmap

the destination to draw into.

density

the compose density to use when drawing.

size

bounds relative to the current canvas to draw within.

onDraw

the render logic.