[Kde-games-devel] KSame

Dmitry Suzdalev dimsuz at gmail.com
Sun Nov 5 12:24:48 CET 2006


On Sunday 05 November 2006 01:37, Henrique Pinto wrote:
> I've read part of the code of KAtomic and KPat to learn how to convert the
> game to SVG, and it seems simple, though I have some questions. Why do you
> need to render the elements onto a QImage first and convert it to a
> QPixmap, instead of rendering directly to the QPixmap? (I suspect it has
> something to do with QImage::Format_ARGB32_Premultiplied, but I'm not sure
> what exactly.)
Yes it has to do with alpha channel.
But personally I'm not sure either :-). Just done as I seen in other places.

So I would like to make this clear.
Please someone who knows answer me (and others who interested) to the 
following questions:

1. We are rendering to QImage and then converting it to QPixmap with the 
purpose to make QPixmap with alpha channel, yes? Why the following won't 
work:
QPixmap pix;
pix.fill( Qt::transparent );

This creates pix with alpha channel too, no?

2. What's the practical difference between QImage::Format_ARGB32_Premultiplied 
and QImage::Format_ARGB32? I see both are used to successfully load svgs - 
first in katomic,kmahjongg,kreversi, second in kpat. What's better to use? 
Why?

Thanks :).
Dmitry.


More information about the kde-games-devel mailing list