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?
CGContextAddPath(context, yourPath);
CGContextClip(context);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With