Question about Qt4 and semi-transparent drawings

Sébastien Laoût slaout at linux62.org
Wed Jul 20 21:04:42 BST 2005


Hello,

I've done some experiments on painting with transparency with Qt3 (like 
blending two images: eg. putting an image 50% opaque on top of another...) 
and that's damn slow!
I looked at KPixmapEffect class source code and this class always transform 
the first QPixmap to a QImage, do the operations (blending a pixmap or image 
on top of another...) and then transform back the result to a QPixmap.
But QPixmap<->QImage transformations are VERY slow.
Then, I discovered QPainter::drawPixmap() can draw semi-transparent pixmaps on 
top of another.
But that's almost as slow as using QPixmapEffect, so I suspect it to do the 
same QPixmap->QImage->QPixmap transformations.

Now, my question:

Is Qt4 allow to do such blendings without having to transform twice the 
pixmaps?

By reading the Qt4 documentation I'm tempted to say "yes", but that would 
surprise me because the Qt3 documentation say that QPixmap is stored in the X 
server memory, while QImage is stored in the application memory. So, if 
transparency can be done in Qt4, it should be allowed by the X protocol... If 
it was the case we would already have optimized QPixmapEffect classe, isn't 
it?

How does Qt4?
Is it as slow as before, or is painting on a QPixmap with an alpha-channel now 
as fast as if we are painting on a QPixmap without alpha-channel?
Does it requiere a recent version of XOrg or a 32bpp X display (since QPixmap 
are stored on the X server side, it should be in 32bpp format, if I'm not 
wrong), or both?
Do we need a powerful graphics card (I still don't have drivers for mine and 
am not alone, so I hope Qt4 will not requiere that) or is it as performant as 
Qt3?

If anyone already worked with those eye-candy or have tested the demos without 
graphics driver... or if someone know how does it works inside...
Thank you for your lightenings.




More information about the kde-core-devel mailing list