blend function urgently needed in kdelibs

Matthew Woehlke mw_triad at users.sourceforge.net
Tue May 22 18:09:34 BST 2007


Matthew Woehlke wrote:
> kdelibs desperately needs a color blending function. I am working on it, 
> planning to have it go in Monday, May 28.
> 
> blend() is reasonably complicated, but the colorspace conversion 
> functions are some of the biggest hitters in terms of code volume. I 
> already have rgb<->hsl (and I think rgb<->hsv, but those are common), I 
> need rgb<->hsy yet but hsy is very similar to hsv. Anyway, since some 
> commented it would be nice to see some actual code, I'm attaching what I 
> have so far...

Updated as per some of Matt's and Thiago's comments. This doesn't /work/ 
yet (some obvious errors, like missing returns) but it compiles this 
time. For the moment I checked it into playground/libs/ui/kcolor so I 
can stop spamming the list with big attachments.

For now I'm going with Matt's suggestion having only one color properly 
represented at a time. I'm allocating 8 color channels (3 more than the 
5 that CMYKA would need, for possible future expansion without having to 
resort to the d-ptr). So it is now possible to allocate a 72/76-byte 
KColor on the stack (64 bytes in m_channel, 4 in m_space, 4/8 in d).

-- 
Matthew
"Nobody expects the traditional Bourne shell!"





More information about the kde-core-devel mailing list