[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Alpha channel support
From:       Rik Hemsley <rik () kde ! org>
Date:       2000-10-28 16:36:17
[Download RAW message or body]

On Fri, 27 Oct 2000 18:56:24 +0200
Antonio Larrosa <antlarr@arrakis.es> wrote:

> I'd like to work on that.
> 
> I don't think we can do anything about using different methods, those
> icons need a special handling as you have to get your background already
> prepared when loading those icons an you have to reload the icons
> whenever the background changes.
> 
> To workaround about this, we can do something like this:
> <(maybe) absurd idea>
> implement a KTIcon class that you create for each icon passing to the
> constructor the icon name and the QWidget object over which you'll
> paint the icon. This way, instead of using QPainter::drawPixmap
> to draw icons, we should use KTIcon::draw(QPainter &p);
> which automatically would get the background of the widget, blend
> the transparency, generate a cache index using QPixmap::serialNumber
> on the background portion over which the icon is painted, and
> paint the icon.
> </(not so) absurd idea > :)
> 
> If you send me the code you already wrote I can continue
> your work on it, if you have other things on your TODO.

Ok, great. I'm not sure about the 'absurd idea' - it gets a little hairy
when the widget changes size or moves w.r.t. the background, but it might
be possible :)

All that really needs to be done in kdelibs is to add a new method to
KIconLoader called loadIconImage(), next to loadIcon(). You can probably
make loadIcon() call loadIconImage(), which is what I did, though I had
to remove the caching stuff, mainly because I was doing a quick hack. You
can probably do it and still cache the pixmaps.

I'll check my blending code into KImageEffect. You can then use
KIconLoader::loadIconImage() and KImageEffect::blend() (or whatever I call
it) to get the icon onto kicker.

Cheers,
Rik

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic