Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw an CGImage with some alpha transparency?

Tags:

iphone

Want to draw an UIImageView which has an CGImage, and the UIImageView has alpha 0.5f. But this CGContextDrawImage function doesnt take an transparency value. So how could I draw an image slightly transparent?

To be clear: The image itself is not transparent, but I want it to be "dimmed" a little bit. Just like you would do with an UIImageView and some alpha like 0.5f :-)

like image 939
dontWatchMyProfile Avatar asked Apr 23 '10 21:04

dontWatchMyProfile


1 Answers

I haven't tried this but try calling CGContextSetAlpha() before CGContextDrawImage().

like image 180
Ole Begemann Avatar answered Nov 19 '22 23:11

Ole Begemann