What to do about KColor?

Matthew Woehlke mw_triad at users.sourceforge.net
Sun May 27 04:06:18 BST 2007


Alex Merry wrote:
> On Sunday 27 May 2007, Matthew Woehlke wrote:
>> Zack has offered an inflexible, slow, and harder (i.e. more steps) to
>> use version of blend() that would be usable by KUrlButton and (with
>> more work) the usability stuff. [snip]
> 
> Just for those who didn't read the mammoth thread on KColor (and I don't 
> blame you), Zack's suggestion was:
> QColor KGraphicsUtils::blendColors(const QColor &one,
>              const QColor &two,
>             QPainter::CompositionMode mode =    
>                   QPainter::CompositionMode_SourceOver);
> 
> (I don't get the harder part, BTW, since it takes three self-explanatory 
> arguments.  But I don't want to start another huge discussion about 
> this, so I'll shut up now.)

Hopefully this reply won't start an argument :-) but it's worth 
clarifying...

Calling Zack's looks like this:
QColor foo = <something>;
foo.setAlpha(<blend amount>); // no default
KGraphicsUtils::blendColors(bar, foo);

Calling mine looks like this:
// don't need blend amount if using 50%
KPalette::blend(bar, foo, [<blend amount>]);

Of course in both cases I am only demonstrating the simplest forms of 
the functions; both have additional optional arguments not shown.

-- 
Mathew
(sorry, .sig file is on the other computer)





More information about the kde-core-devel mailing list