Skip to content

Instantly share code, notes, and snippets.

@andrei512
Created September 21, 2012 11:37
Show Gist options
  • Save andrei512/3760999 to your computer and use it in GitHub Desktop.
Save andrei512/3760999 to your computer and use it in GitHub Desktop.
-////////////////////////////////////////////////////////////////////////////////////
- UIImage *maskImg = [UIImage imageNamed:@"Ethics-Risk-Triangle.png"];
- CGImageRef maskRef = maskImg.CGImage;
-
- CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
- CGImageGetHeight(maskRef),
- CGImageGetBitsPerComponent(maskRef),
- CGImageGetBitsPerPixel(maskRef),
- CGImageGetBytesPerRow(maskRef),
- CGImageGetDataProvider(maskRef), NULL, false);
-
- CGImageRef masked = CGImageCreateWithMask(img.CGImage, mask);
- UIImage *image = [UIImage imageWithCGImage:masked];
- CGImageRelease(mask);
- CGImageRelease(masked);
-
-// img = image;
-// imgData = UIImagePNGRepresentation(img);
-////////////////////////////////////////////////////////////////////////////////////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment