blend function urgently needed in kdelibs

Matthew Woehlke mw_triad at users.sourceforge.net
Mon May 21 22:13:53 BST 2007


Andreas Pakulat wrote:
> On 21.05.07 22:19:15, Thomas Zander wrote:
>> For most 
>> other things, QColor:lighter() and darker() seem to do the trick...

Um... no they don't. Not at all.

> IIRC the blend() function from Matthew works better in terms of the
> result, i.e. if you use QColor::lighter() the result is not always as
> one would expect. I'm not sure why or in what way (and how much that
> affects usability - i.e. how it fits with the selected style), Matthew
> surely know that better.

Exactly. There's a reason I wrote my own lighten() and darken() for 
blueglow (will be Ion in KDE4). KColor will also implement these, 
although they will of course just be convenience wrappers to blend() :-).

IIRC: Mostly the problem is that lighten() does not scale linearly and 
can hit a 'wall' with certain (not white) colors where it effectively 
stops working. The root of the problem is that TT's lighten() and 
darken() use the HSV color model, whereas the HSL model is more correct 
(and HSY is closer still). KColor will use at least HSV by default, 
maybe even HSY, and blend() will let you choose *any* of the above.

(I also have a bug open with TT to support HSV... it's gotten as much 
reaction as blend(), which is to say someone from TT originally told me 
not to add this to KDE because Qt should do it, and nothing AFAICS has 
happened since.)

-- 
Matthew
When in doubt, duct tape!





More information about the kde-core-devel mailing list