Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Urip

macrumors newbie
Original poster
Oct 27, 2008
4
0
Well, the situation goes as follows :cool:
I have a CGImage (filled in black for all I care). Every once in a while, I want to erase a circle in a given position and size from the CGImage.
In erasing I mean drawing a transparent circle in a specific position in the CGImage...
I know I can create a mask image with the circle I want to erase, and mask the CGImage each time I want to erase some... but creating a mask image and a new context, and than drawing a new image to the context with masking each time it is very expensive operations.
So I ask you, what is the most efficient way for me to do this?


thanks!!
 
See if CGContextClearRect does the trick.

Edit: actually that will require you remake a new context each time if you're using CGImages since they aren't mutable through Quartz. Depending on how you're using the image, you could make a CGLayerRef and then modify that and redraw it into your view.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.