I want to modify FingerPaint application and add undo and redo features to it. It basically draws Path's to the canvas at onDraw method and draws same paths to a bitmap too. Anyway my first thought was to save bitmaps as files but there might be some more efficient way . I am waiting for suggestions.
You can create a new canvas, push it onto a stack, set it to the same width
and height
, and then use drawImage()
with the main canvas as the first image to copy the contents over. To undo, walk down the stack and use drawImage()
in reverse. (Don't pop off the stack, or you won't be able to redo.)