How to make undo with Canvas

  1. Keep track of all Canvas drawing events.
  2. To undo the last event, do the converse of the last event (for a line draw, that would mean drawing a line with paint color the same as background color).

How do I do that :thinking:

I would suggest something similar.
Save the current canvas image on a temp local image every time before the user starts to draw something.
When he draws something and after he press undo, set the canvas image from the temp local image.
This can be useful only for one step undo.

see also Scott’s example here



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.