Welcome to the iMore Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. Thread AuthorThread Author   #1  
    Raeki's Avatar
    iPhone Intermediate

    107 Posts
    Global Posts
    108 Global Posts

    Default iPhone CoreGraphics Mask?

    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*) maskImageUIImage *)image withMaskUIImage *)maskImage {

    CGImageRef maskRef = maskImage.CGImage;

    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
    CGImageGetDataProvider(maskRef), NULL, false);

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


Posting Permissions