PDA

View Full Version : QPixmap transparancy



ian
19th February 2007, 01:13
Hi,

I am trying to load a .BMP file into a QPixmap and then retrieve a HBITMAP handle so I can to do some Windows specific stuff. However, when I do this I am still seeing the background colour. How do I go about masking out the background colour in the pixmap?

At present I am attempting this:


QPixmap telescopePixmap( ":/images/Tscpblue.bmp" );
m_telescopeImage = telescopePixmap.toWinHBITMAP( QPixmap::PremultipliedAlpha );

ian
19th February 2007, 01:20
I got this sorted out. It just needed the extra line of code as follows:


QPixmap telescopePixmap( ":/images/Tscpblue.bmp" );
telescopePixmap.setMask( telescopePixmap.createHeuristicMask() );
m_telescopeImage = telescopePixmap.toWinHBITMAP( QPixmap::PremultipliedAlpha );

wysota
19th February 2007, 01:57
Don't you just love it when people solve their problems on their own? :)

ian
19th February 2007, 02:01
Yes. Sometimes just talking it through does the trick :)