0

I'm playing around with Canvas on Android and I have a question : is it possible to keep the previous drawing of the canvas between each onDraw call ?

For example, if I draw a path with a Style.STROKE for his Paint and the path totally change between each onDraw call, is it possible to draw the new path on previous drawings ? Without storing each path ?

Thank you !

JosselinTD
  • 611
  • 1
  • 8
  • 17

1 Answers1

0

Canvas comes back cleaned every time onDraw is called. If you want to remember previous drawings, you will need to draw onto a different Bitmap, and then draw that to the canvas. See for example https://stackoverflow.com/a/2426222/834966

Community
  • 1
  • 1
Daniel Fekete
  • 4,988
  • 3
  • 23
  • 23