CGContextSetRBStrokeColor to replace, not add, for alpha?

Posted by Peter Hajas on Stack Overflow See other posts from Stack Overflow or by Peter Hajas
Published on 2010-05-06T23:21:49Z Indexed on 2010/05/06 23:28 UTC
Read the original article Hit count: 389

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?

© Stack Overflow or respective owner

Related posts about cgcontext

Related posts about quartz-2d