Question

I am doing some drawing using a CGContext. I am currently masking the drawing using a png file like this:

UIImage * myImage = [UIImage imageNamed:@"frame.png"];
CGContextRef context = UIGraphicsGetCurrentContext ();
CGContextClipToMask(context, self.view.bounds, myImage.CGImage);

This works fine, but now I'd like to use an existing CGPathRef as my mask. Should I look at converting the CGPathRef to a UIImage and mask as above? If so how would I go about doing the conversion? -OR- Is there a better way to approach this?

Was it helpful?

Solution

CGContextAddPath(context, yourPath);
CGContextClip(context);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top