Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, February 2007
Alpha channel in Pixmap used to work


Message 1 in thread

Hi Qt experts,

I used to work with Qt with qt-x11-free-3.3.5 about a half year ago. The 
program I worked on at that time was a kind of  graphic program which 
based on handling images with alpha channel (PNG).  Deciding that I will 
improve my program I started to use the latest qt-x11-free edition the 
qt-x11-free-3.3.7. (I deliberately  use Qt 3 because Qt 4 proved to be 
slower in drawing.) The following code worked perfectly with qt 3.3.5 it 
worked as I expected, but the compiling it with qt.3.3.7 did not yield 
the desired result, that is the alpha blending did not work.

QPixmap image1("image_no_alpha.png");
QPixmap image2("image_with_alpha.png");

QPainter painter();

painter.begin(this);
.
.
    painter.drawPixmap(0,0,image1);
    painter.drawPixmap(0,0,image2);
.
.
painter.end();

image2.hasAlphaChannel() returns false, which makes me think that the 
alpha channel information is destroyed when creating image2.

Unfortunatelly I don't have my previous configuration.

An important information that I compiled the qt framework -static option 
in both case. Running the program compiled with qt 3.3.5 works perfectly 
in my present configuration, that is alpha channel handling works, but 
when I compile it with 3.3.7 the result makes me feel blue. The only 
difference between my present and my former configuration beside the 
version of Qt is that I am using now Xorg instead of Xfree86.

A new thought has just came to my mind, I remember that I compiled qt 
3.3.5 with -system-libpng switch. But I am not entirely sure in this. 
Maybe could it cause that alpha channel does not work now?

Has anybody an idea of the root of the failure, because I am completely 
desperated related to this issue. Why did it use to work, and why do not 
work it now?

Please help, any idea will be appreciated highly.

Best Regards:
Krisztian

--
 [ signature omitted ]