Justin Boo
Justin Boo

Reputation: 10198

Cocoa: How to erase line from image by painting?

How to erase line from image (for example CIImage or NSImage or bitmap) by painting it? Just like eraser. I wonder how to do that with Core Graphics?

Upvotes: 0

Views: 869

Answers (1)

jrturton
jrturton

Reputation: 119242

This is definitely a dupe (I even answered the dupe!) but I cant find it at the moment due to the phone searching being a little fiddly. So, apologies for that, here is the gist of the other answer:

You can do this, assuming your lines are drawn on a separate, equally sized view on top of the image view, by setting the drawing colour to colorWithPatternImage:, using the image view image. Lines drawn with this colour "erase" whatever was previously on the view by effectively drawing small sections of the underlying image on top of your existing drawn lines.

Upvotes: 1

Related Questions