Render an element normally drawn within a Compose Canvas into a Bitmap and then convert to a Tiles ImageResource.
@RequiresApi(VERSION_CODES.O) public fun canvasToImageResource( size: Size, density: Density, onDraw: DrawScope.() -> Unit ): ImageResource { return Bitmap.createBitmap( size.width.toInt(), size.height.toInt(), Bitmap.Config.RGB_565, false ).apply { drawToBitmap(bitmap = this, density = density, size = size, onDraw = onDraw) }.toImageResource() }