I created a drawing program. It works great, you can import an image and annotate it with different colors and brush configurations.
My problem is I can't figure out how to allow erasures. I wrote this same app for android and use a PorterDuffXferMode object to erase. I haven't been able to find something similar here in Cocoa.
Am I missing something obvious? I'm a Cocoa nube.
I'm drawing into an NSView using combinations of NSBezierPath and NSRectFill.
Update:
Before reading the responses here I modified my code to use a nested NSView below my original NSView. So my thought was to draw the background image on the bottom Z-order view and do all the graphics on the top NSView. It draws fine, but in my top view I am calling NSClearRect on an area I want to erase and it's white instead of erasing to the bottom layer.
Why doesn't it show through to the bottom layer?
I'm going to look into using CALayers but you'll have to give me some time to digest what you all have written. Like I said before, I'm a noob to objective C and Cocoa.
CGContextBeginTransparencyLayer()
... – nielsbot