Simple Painting:
Fingering the iPhone screen paints temporary graphics to a UIView. These temporary graphics are erased after a touch ends, and are then
Why not just draw everything onto a CGBitmapContextRef
buffer so the drawing operations will accumulate, and then draw that to the screen in your drawRect:
? You will be able to perform arbitrary graphics operations without slowing down as the total number of operations increases.
If undo support is necessary, one could always keep a copy for each change made and invalidate the oldest copies when a memory warning is received. (or for an even fancier solution, store the operations as you do now, but keep a cached copy every dozen user operations or so)