[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: KoColor && CMYK -> RGB
From:       Boudewijn Rempt <boud () valdyas ! org>
Date:       2003-10-23 22:11:37
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Thursday 23 October 2003 23:09, Boudewijn Rempt wrote:
> Well, my CMYK strategy works now without crashes -- and it gets called,
> too, so that's nice. But I fear that there might be a bug in KoColor. Since
> KoColor isn't used anywhere but on in Krita, but is still in the koffice
> lib, I crossposted.  Is there still anyone maintaining this useful class?
>
> Anyway, given a nice, white RGB color (255, 255, 255), this function
> gives (255, 255, 255, 255) -- which is as black as can be.
>
> void KoColor::RGBtoCMYK(int R, int G, int B, int *C, int *M, int *Y, int
> *K) {
>   int min = (R < G) ? R : G;
>   *K = (min < B) ? min : B;
>
>   *C = 255 - (R - *K);
>   *M = 255 - (G - *K);
>   *Y = 255 - (B - *K);
> }
>

I've changed this to 

void KoColor::RGBtoCMYK(int R, int G, int B, int *C, int *M, int *Y, int *K)
{
    *C = 255 - R;
    *M = 255 - G;
    *Y = 255 - B;

    int min = (*C < *M) ? *C : *M;
    *K = (min < *Y) ? min : *Y;

    *C = *C - *K;
    *M = *M - *K;
    *Y = *Y - *K;
}

In the end, following Foley etc., who I should have consulted first, instead 
of googling. The difference with the previous being that I first convert to 
CMY, instead of subtracting the K from RG and B. 

Anyway, since this is a real, life koffice lib -- can I check this in? It 
seems to produce the right results in Krita.
-- 
Boudewijn Rempt | http://www.valdyas.org/index2.html

[Attachment #5 (application/pgp-signature)]

_______________________________________________
kimageshop mailing list
kimageshop@mail.kde.org
http://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic