I draw in a CGContext and using a mask based on CGImageRef:
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextClipToMask(context, rect, _firstMaskImageRef); CGContextSetFillColorWithColor(context, color); CGContextFillRect(context, rect);
I have a second mask, which I then want to switch to:
CGContextClipToMask(context, rect, _secondMaskImageRef); CGContextSetFillColorWithColor(context, color);
But this crosses two masks instead of replacing the first.
How can you (if you can) clear or reset the clipping mask for a CGContext?
source share