How to draw a CGImage with some alpha transparency?

Want to draw a UIImageView with CGImage and a UIImageView alpha 0.5f. But this CGContextDrawImage function does not accept the value of transparency. So, how could I make the image slightly transparent?

To be clear: the image itself is not transparent, but I want it to go out a bit. Just as you would do with a UIImageView and some alpha, e.g. 0.5f :-)

+4
source share
1 answer

I have not tried this, but I will try to call CGContextSetAlpha() before CGContextDrawImage() .

+14
source

Source: https://habr.com/ru/post/1307827/


All Articles