I'm generating a series of SHCircle's which I want to use as a bitmap mask using this method:
+(SPTexture *)maskedTextureWithSource:(UIImage *)sourceImg andMask:(UIImage *)maskImg
{
CGImageRef maskRef = maskImg.CGImage;
CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);
CGImageRef masked = CGImageCreateWithMask([sourceImg CGImage], mask);
UIImage *maskedImg = [UIImage imageWithCGImage:masked];
return [[SPTexture alloc] initWithContentsOfImage:maskedImg];
}
Found at: http://forum.sparrow-framework.org/topic/bitmap-masking
Is there an easy way for me to turn my SHCircles, or the sprite that contains them into a UIImage?