Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom Drawing on Canvas without KTX
val translateCheckpoint = canvas.save()
canvas.translate(200f, 300f)
canvas.drawCircle(150f, 150f, RADIUS, circlePaint) // drawn on the translated canvas
val rotateCheckpoint = canvas.save()
canvas.rotate(45f)
canvas.drawRect(rect, rectPaint) // drawn on the translated and rotated canvas
canvas.restoreToCount(rotateCheckpoint)
canvas.restoreToCount(translateCheckpoint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment