I use CGContexts to allow the user to draw in my application, here's an example:
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); CGContextSetLineWidth(UIGraphicsGetCurrentContext(), size);
CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(),r,g,b,a);
I want the user to have an "eraser" tool that actually erases - it can't draw white (that would add white to the image, which may not have a white background) or alpha (or else the stroke won't do anything). Is there a way to do this? Perhaps replacing contents of a CGContext or UIImage?