Punching holes into IKImageView
I have an IKImageView and would like to create holes, i.e. set alpha to zero in some rectangle.
And then save the result in some format.
What would be the easiest way to do this?
1. Create a CIFilter and do:
myIkImageView.imageCorrection = myHoleFIlter
CGImageRef cgImage = [ myIkImageView image ];
NSBitmapImageRep *bp = [ [NSBitmapImageRep alloc ] initWithCGImage: cgImage];
NSColor *c = [ NSColor clearColor];
for the intended rectangle do: [ bp setColor: c atX: ... y: ...];
CGImageRef new = [ bp CGImage ];
[ myIkImageView setImage: new imageProperties: ...];
3. Something else? Maybe just use an existing filter (CISourceOverCompositing ?) to put a clear rectangle on top?
Efficiency is not the prime concern. It would be acceptable if it takes a few seconds to create a hole.
I have no experience with CIFilter yet.