Priyansh Nama
12/12/2024, 12:26 PMval textPaint = android.graphics.Paint().apply {
color = md_theme_chip_text.toArgb()
textSize = labelTextSize
}
drawContext.canvas.nativeCanvas.drawText(
"C3", 0f, y, textPaint
)
i am using this code to print some text inside the canvas
but when same code i am using in common main
it gives errors .drawText() is not available
so how to migrate ?russhwolf
12/12/2024, 4:12 PMnativeCanvas
is a platform-specific type. It's android.graphics.Canvas
on Android and org.jetbrains.skia.Canvas
on other platforms. You can only access the Android-specific stuff from Android, not from common. To migrate, you can try defining your own expect fun
in common that delegates to the platform-specific text APIs.Priyansh Nama
12/16/2024, 10:37 AMrusshwolf
12/16/2024, 8:10 PM