Transparent background for widgets in KHTML

Rafael Fernández López ereslibre at kde.org
Thu Mar 13 18:51:18 GMT 2008


Hi Germain and all,

> From some experiments I did and reading Qt source, it seems activating the
> alpha channel can be the most cheaply done (on X) by using QPixmap::fill
> with Qt::transparent.
>
> This need to be done only once. For subsequent reuses of the pixmap, it's
> then possible to use the Source composition mode to fill only a
> sub-rectangle with Qt::transparent (Clear compsition mode is clearly
> completely broken).
>
> So all in all, I think the best would be to handle all blanking of buffers
> directly in misc/paintbuffer.{cpp,h}, maybe passing the sub-rectangle we
> want to blank as another argument of PaintBuffer::getBuf.
>
> e.g. whenever it would return a new pixmap => use QPixmap::fill with
> Qt::transparent, otherwise only blank the requested rectangle.
>
> This should actually also fix transparency problems with CSS3 opacity
> buffers, which I have sometime noticed, as they used the same method for
> blanking.

I think I'm missing something. I understand creating the mask and applying it 
is not cheap, and that there are better ways of doing so. I understand we can 
fill the pixmap with Qt::transparent and with alpha channel set to 100%, 
later set it to 0% (or whatever CSS specifies) and draw the pixmap.

The only thing I can't understand is, why we need a method that needs a 
sub-rectangle. I guess what we need to pass to this method is the widget 
pixmap (which is a pixmap with the widget size) and do the next:

1. Set Alpha channel to 100% transparency
2. Fill with Qt::transparent
3. Restore Alpha channel
4. Render widget

From we have been talking on #khtml, it seems that doing this is more or less 
the same as setting a mask. That depends now:

- We could still go through the mask strategy, even knowing that it is slower 
(the other alternatives that could work are in the same terms of slowness). 
This one works for sure, the patch works.

- We could try to do the previous steps, and see if it works. From what 
Fredrik, said, it seems this would be more or less as slow as setting the 
mask.

Since I don't know what paintbuffer does, if it is applied to all pixmaps or 
not, and it has no documentation... Well, if this class is used for every 
pixmap, the lose in time is not critical.

What do you think ?


Bye and thanks,
Rafael Fernández López

GPG Fingerprint: B9F4 4730 43F8 FFDD CC5E BA8E 724E 406E 3F01 D070
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20080313/a54b35b6/attachment.sig>


More information about the kfm-devel mailing list