Well, using coregraphics, I create an image that will be used later in the CGContextClipToMask operation. It looks something like this:
UIImage *eyes = [UIImage imageNamed:@"eyes"]; UIImage *mouth = [UIImage imageNamed:@"mouth"]; UIGraphicsBeginImageContext(CGSizeMake(150, 150)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(context, 0, 0, 0, 1); CGContextFillRect(context, bounds); [eyes drawInRect:bounds blendMode:kCGBlendModeMultiply alpha:1]; [mouth drawInRect:bounds blendMode:kCGBlendModeMultiply alpha:1];
Now, as you can see from the commentary, I wonder how I'm actually going to use the image I created. The reason I use the main graphics here, and not just create a UIImage, is because the transparency I create is very important. If I just take a UIImage from the context, when it is used as a mask, it will apply to everything ... In addition to this, will I have problems using a partially transparent mask using this method?
ios cocoa-touch uikit core-graphics mask
Nonatomicretain
source share