Drawing and arc on a canvas
Canvas(modifier = Modifier.fillMaxSize()) {
drawArc(
Color.Green,
30f,
90f,
topLeft = Offset(0f, 0f),
useCenter = true,
size = Size(sizeInPx, sizeInPx)
)
}
I would like to draw text along the inside of that arc. Looks like I can use drawIntoCanvas and get ahold of the native canvas:
Canvas(modifier = Modifier.fillMaxSize()) {
drawIntoCanvas {
it.nativeCanvas.drawText(
sector.text,
0f,
0f,
Paint().apply {
setColor(android.graphics.Color.BLACK)
textSize = textSizeInPx
}
)
}
}
However that is not drawing along the arc path. From some searching looks like maybe there used to be a compose drawText method, but I don’t see that anymore.
Looks like I might be able to use nativeCanvas.drawTextOnPath(), which requires another calculation of the arc. Am I going down the correct path?