iPhone CoreGraphics Mask?

Raeki

Well-known member
Feb 22, 2010
107
0
0
Visit site
I am making a mask for a winterboard theme, and found this article: How to Mask an Image

It gives the code for the masking, and I have made my mask. However, I was wondering where do I put the code for it? I'm guesing it is in the System/Library/CoreServices file but I don't really know what it is and don't want to screw up some Core Services (it sounds important).

Does anyone know how to use it?

BTW the code is:
- (UIImage*) maskImage:(UIImage *)image withMask:(UIImage *)maskImage {

CGImageRef maskRef = maskImage.CGImage;

CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
CGImageGetHeight(maskRef),
CGImageGetBitsPerComponent(maskRef),
CGImageGetBitsPerPixel(maskRef),
CGImageGetBytesPerRow(maskRef),
CGImageGetDataProvider(maskRef), NULL, false);

CGImageRef masked = CGImageCreateWithMask([image CGImage], mask);
return [UIImage imageWithCGImage:masked];

}
 

Latest posts

Trending Posts

Members online

Forum statistics

Threads
260,349
Messages
1,766,511
Members
441,239
Latest member
FallDesigner