Does anyone know how to do either of the following...
# compose-desktop
s
Does anyone know how to do either of the following: 1. Turn a
Painter
into a skia
Image
2. Turn an SVG into a skia
Image
instead of a
Painter
m
Dunno how that helps but I use something like this:
Copy code
@Composable
    operator fun get(vector: ImageVector, density: Density, size: DpSize): ImageBitmap {
        val widthPx = with(density) { size.width.roundToPx() }
        val heightPx = with(density) { size.height.roundToPx() }
        val sizeF = Size(widthPx.toFloat(), heightPx.toFloat())
        val image = ImageBitmap(widthPx, heightPx)
        val cnv = androidx.compose.ui.graphics.Canvas(image)
        val painter = rememberVectorPainter(vector)
        CanvasDrawScope().draw(density, LayoutDirection.Ltr, cnv, sizeF) {
            with(rememberVectorPainter(vector)) {
                draw(sizeF)
            }
        }
        return image
    }