[Qt-interest] setting Alphatransparency while drawing image

Samuel Rødal sroedal at trolltech.com
Fri Dec 12 10:38:29 CET 2008


Prasanta Sadhukhan wrote:
> Hi,
> 
> I want to set the alphatransparency while drawing an image but am not 
> sure how to do it
> In the attached program, if I want to set the alpha transparency to 0.5 
> (ie., 128) [0 being full transparent, 1 being full opaque) so that the 
> image drawn is half-transparent, what I need to do in AWT_drawimage() 
> function? Now, as I see from the output, the image drawn is fully opaque
> 
> Any idea is welcome
> 
> Regards
> Prasanta

Use QPainter::setOpacity() with a value of 0.5 before drawing the image.

--
Samuel



More information about the Qt-interest-old mailing list