[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/lib/kopainter
From: Boudewijn Rempt <boud () valdyas ! org>
Date: 2003-10-24 19:14:25
[Download RAW message or body]
CVS commit by rempt:
Fixed the cmyk-rgb algorithm. Included pointer to a better, but more expensive
algorithm.
M +17 -6 koColor.cc 1.5
--- koffice/lib/kopainter/koColor.cc #1.4:1.5
@@ -20,5 +20,5 @@
#include "koColor.h"
-
+#include "kdebug.h"
#include <cmath>
@@ -449,11 +449,22 @@ void KoColor::RGBtoLAB(int R, int G, int
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;
+ // XXX: these algorithms aren't the best. See www.littlecms.com
+ // for a suitable library, or the posting by Leo Rosenthol for
+ // a better, but slower algorithm at
+ // http://lists.kde.org/?l=koffice-devel&m=106698241227054&w=2
+
+ *C = 255 - R;
+ *M = 255 - G;
+ *Y = 255 - B;
+
+ int min = (*C < *M) ? *C : *M;
+ *K = (min < *Y) ? min : *Y;
+
+ *C -= *K;
+ *M -= *K;
+ *Y -= *K;
- *C = 255 - (R - *K);
- *M = 255 - (G - *K);
- *Y = 255 - (B - *K);
}
+
void KoColor::HSVtoRGB(int H, int S, int V, int *R, int *G, int *B)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic