How to dynamically add transparency to iPhone image?
-
06-07-2019 - |
Question
Suppose I have image canvas or previously loaded image which supports transparency (gif/png). What are the steps to implement changing transparency for the image, but not for the whole image, but only a part of it? I undestand I should use CGContext, but i'm lacking the details.
Solution
1) create a memory buffer
2) cast it into a CGContext
with alpha by using CGBitmapContextCreate
3) draw your image into it with CGContextDrawImage
4) modify the mask via the buffer you created in step 1.
5) $$$
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow