[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: What to do about KColor?
From: Andreas Pakulat <apaku () gmx ! de>
Date: 2007-05-28 20:47:45
Message-ID: 20070528204745.GC14415 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]
On 28.05.07 21:34:01, Thomas Zander wrote:
> On Monday 28 May 2007 20:40:58 Alex Merry wrote:
> > I agree with this - the function name is very confusing, because it
> > _doesn't_ blend two colours. It overlays the second on the first.
>
> That entirely depends on your definition of what a color is.
> Beginning in Qt4, and in other toolkits quite a bit longer, the definition
> of a color is *including* the alpha channel. And with that in mind, the
> blend method indeed does exactly what it says.
Hmm, but why is the alpha channel of the first color not taken into
account then? How does a user blend two colors that he gets from the
palette where he doesn't know wether they have an alpha value or not? Do
I have to check for that and then just do the blend and if the 2nd color
doesn't have an alpha value then I need to set one? Sorry but thats just
unintuitive API.
> As I (and Aaron) stated elsewhere; lets see where actual apps end up
> using this and avoid this 'design by committee' re-painting of the
> bikeshed.
So you want some code? How's this:
QColor background = QApplication::palette().window().color();
QBrush foreground = ret->foreground();
if( background.alphaF() > 0 )
foreground.setColor(KGraphicsUtils::blendColor(QApplication::palette().highlight().color(), \
background)); else
{
background.setAlpha(128);
foreground.setColor(KGraphicsUtils::blendColor(QApplication::palette().highlight().color(), \
background)); }
ret->setForeground(foreground);
from
trunk/kdevelop/buildtools/builder/makebuilder/outputfilters.cpp:143
Unfortunately there has been a bug introduced recently in the
makebuilder which leads to it not showing the highlighting. I didn't
have time to look into that yet.
Instead of the above I'd like to do just
QBrush b = ret->foreground();
b.setColor( KGraphicsUtil::blendColor(
QApplication::palette().highlight().color(),
QApplication::palette().window().color())
);
ret->setForeground(b);
Andreas
--
A vivid and creative mind characterizes you.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic