Ever had issues with your CoreGraphics image masks just refusing to work right? Yeah, us too. But here’s a tip on how to make them reliable:
…Thus, I’ve found that the best and most reliable way to generate an image mask from an arbitrary image is to do this:
- Create a bitmap graphics context that is in an acceptable format for image masks
- Draw your image into this bitmap graphics context
- Create the image mask from the bits of the bitmap graphics context…
Well, that’s certainly straightforward, long as your images aren’t big enough to cause memory issues, isn’t it? Function provided at the link, enjoy!
h/t: iOS Development Goodies!
31
AUG
AUG
0
Share