- Undo/redo
To implement this, just keep a table of “actions” as your history, then revert to/reapply to the correct index when you toggle the undo/redo function.
Pseudocode:
[lua]
history = {}
currentHistory = 1
on draw release = [add an element to history equal to {points that were drawn on this stroke}, and increment currentHistory]
to undo = [delete the last lines, and decrement currentHistory]
to redo = [draw a line according to the points in history[currentHistory], and increment currentHistory]
[/lua]
[edit] Sorry, looks like the forum code highlighter has broken the formatting 
Don’t forget to clear the history up to your current point when you draw after undoing.
-
I think this is quite complicated, and I can’t give you any viable code off the top of my head. My initial response (based on Corona’s inability to efficiently examine pixels) would be to keep a table of polygons based on where your lines are drawn, then fill them in with a function like horacebury’s polygon fill function.
-
Add a drawing listener that just stores the start x/y location of the touch, then draws a line from the start to the end, instead of lines all the way along the touch.
-
Instead of drawing a vector line (which I assume you’re doing), scale an image to the length of your line, rotate it, and position it accordingly.
-
I’m fairly sure there’s a pinch-zoom library on the code exchange; that’s an easy way to do it.
-
Check out the Corona sample ‘Media/PhotoPicker’. Basically, what you’ll do is import a photo, and put it in the background to draw on.