Skip to content

Instantly share code, notes, and snippets.

@cp-radhika-s
Created November 8, 2022 09:03
Show Gist options
  • Save cp-radhika-s/35dcb3ed26fcea92a39521a10e8540ec to your computer and use it in GitHub Desktop.
Save cp-radhika-s/35dcb3ed26fcea92a39521a10e8540ec to your computer and use it in GitHub Desktop.
@Composable
fun NativeDrawText() {
val paint = Paint().asFrameworkPaint().apply {
// paint configuration
}
Canvas(modifier = Modifier
.fillMaxWidth()
.height(100.dp), onDraw = {
drawRect(color = Color.Black)
drawIntoCanvas {
it.nativeCanvas.drawText("Text on Canvas!", 20f, 200f, paint)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment