canvasToImageResource

Render an element normally drawn within a Compose Canvas into a Bitmap and then convert to a Tiles ImageResource.

Parameters

size

the size of the bitmap desired in pixels.

density

the compose density to use when drawing.

onDraw

the render logic.