changing KGraphicsUtils?

Matthew Woehlke mw_triad at
Wed May 30 21:35:59 BST 2007

A number of people have expressed confusion/dissatisfaction over the 
implementation of blendColors that Thomas committed. In an attempt to 
address these comments, I would like to suggest supporting two methods 
for the moment; Zack's, and mine. To make it very clear which does what, 
I have adopted Hans Meine's suggestion of making the names mix() and 
overlayColors() (feel free to argue for mixColors() and/or overlay(), 
and/or paint[Colors]() as an alternative to overlay[Colors]()).

mix() does a basic linear blend, treating the alpha channel as 'just 
another channel', which is the correct behavior if one is calculating 
bands in a gradient. At least Ingo Klöcker also suggested this behavior. 
This signature is an exact match for what is in KDevelop 3.4 (which 
originated in Ion's predecessor) and can immediately replace 
alphaBlendColors in Plastik with only very minor effort (although it has 
been questioned whether Plastik will ultimately need this method or not).

Also, about the name... I don't like it. :-) (And IIRC there was exactly 
zero discussion about it.) Since I expect this namespace to ultimately 
hold a good chunk of the usability stuff, what about KColorUtils 
instead, since we are working with colors and not* images?

(* Hans mentioned a case where we might take an image as input and 
produce a color as output, but I think the outputs are always colors or 
related to color. IOW this is not kdefx :-).)

Patch attached. Please comment on any clean-up (naming, formatting, etc) 
needed as well. This also fixes some existing consistency problems (e.g. 
TestBlendColors not matching the naming scheme of other kdeui tests, the 
error in the blendColors example code). I would like to commit Monday if 
there are no (unresolved) issues at that time.

Ideas in this e-mail are larger than they appear and the writer may be 
smarter than he appears.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kcolorutils.patch
Type: text/x-patch
Size: 9604 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list