What to do about KColor?

Ingo Klöcker kloecker at kde.org
Mon May 28 12:31:54 BST 2007


On Monday 28 May 2007 10:12, Thomas Zander wrote:
> On Monday 28 May 2007 03:31:54 Andreas Pakulat wrote:
> > On 28.05.07 02:36:37, Thiago Macieira wrote:
> > > Andreas Pakulat wrote:
> > > >b) everybody who wants to blend two colors now has to do 3 lines
> > > > of code (as Matthew showed) instead of just one.
> > >
> > > Non-issue.
> > >
> > > More lines is better if it makes code more readable.
> >
> > Right, but I don't see how setting the Alpha on a Qcolor to make
> > blend work properly makes the code more readable. I think that
> > should be part of the implementation, all I as an API user want is
> > to blend between two colors and give a ratio for that.
>
> I, for one, think that its entirely natural that a color has an alpha
> channel and thus that if you blend two colors that it would be odd
> and unnatural to _also_ add an alpha to the argument list.
>
> For most KDE / Qt programmers an alpha channel is new in version 4,
> but if you come from a toolkit like Java this has existed for many
> years.  So, I can imagine that it takes a while to adjust to this
> change in concept.
>
> Lets see if people find it a bit odd.

I find it more than a bit odd. I imagine most of us do not come from 
Java. If I want to blend two colors I want to call blend( c1, c2 ) and 
get the result Matthew's code would have returned (w.r.t. the 
default "mixing factor" of 0.5).

To be honest, I'm quite disappointed about the outcome of this 
discussion. I would have prefered Matthew's last proposal over Zack's 
awkward (using a 1 pixel QImage and QPainter just to blend two colors? 
Hello?) and inferior workaround. Now everybody who wants better color 
blending/lightening/darkening will have to copy Matthew's code. *sigh*

Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070528/8ebb5f35/attachment.sig>


More information about the kde-core-devel mailing list