There seems to be a problem rendering PDF's using CMYK colors (see bug
14526).  Attached is a patch that should repair this problem.

Troy Henderson
diff -aur clean/poppler-0.6.1/poppler/GfxState.cc unclean/poppler-0.6.1/poppler/GfxState.cc
--- clean/poppler-0.6.1/poppler/GfxState.cc	2007-09-17 13:37:39.000000000 -0500
+++ unclean/poppler-0.6.1/poppler/GfxState.cc	2008-02-16 20:25:30.000000000 -0600
@@ -618,65 +618,18 @@
 }
 
 void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
-  double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
-    
-  c = colToDbl(color->c[0]);
-  m = colToDbl(color->c[1]);
-  y = colToDbl(color->c[2]);
-  k = colToDbl(color->c[3]);
-  c1 = 1 - c;
-  m1 = 1 - m;
-  y1 = 1 - y;
-  k1 = 1 - k;
-  // this is a matrix multiplication, unrolled for performance
-  //                        C M Y K
-  x = c1 * m1 * y1 * k1; // 0 0 0 0
-  r = g = b = x;
-  x = c1 * m1 * y1 * k;  // 0 0 0 1
-  r += 0.1373 * x;
-  g += 0.1216 * x;
-  b += 0.1255 * x;
-  x = c1 * m1 * y  * k1; // 0 0 1 0
-  r += x;
-  g += 0.9490 * x;
-  x = c1 * m1 * y  * k;  // 0 0 1 1
-  r += 0.1098 * x;
-  g += 0.1020 * x;
-  x = c1 * m  * y1 * k1; // 0 1 0 0
-  r += 0.9255 * x;
-  b += 0.5490 * x;
-  x = c1 * m  * y1 * k;  // 0 1 0 1
-  r += 0.1412 * x;
-  x = c1 * m  * y  * k1; // 0 1 1 0
-  r += 0.9294 * x;
-  g += 0.1098 * x;
-  b += 0.1412 * x;
-  x = c1 * m  * y  * k;  // 0 1 1 1
-  r += 0.1333 * x;
-  x = c  * m1 * y1 * k1; // 1 0 0 0
-  g += 0.6784 * x;
-  b += 0.9373 * x;
-  x = c  * m1 * y1 * k;  // 1 0 0 1
-  g += 0.0588 * x;
-  b += 0.1412 * x;
-  x = c  * m1 * y  * k1; // 1 0 1 0
-  g += 0.6510 * x;
-  b += 0.3137 * x;
-  x = c  * m1 * y  * k;  // 1 0 1 1
-  g += 0.0745 * x;
-  x = c  * m  * y1 * k1; // 1 1 0 0
-  r += 0.1804 * x;
-  g += 0.1922 * x;
-  b += 0.5725 * x;
-  x = c  * m  * y1 * k;  // 1 1 0 1
-  b += 0.0078 * x;
-  x = c  * m  * y  * k1; // 1 1 1 0
-  r += 0.2118 * x;
-  g += 0.2119 * x;
-  b += 0.2235 * x;
-  rgb->r = clip01(dblToCol(r));
-  rgb->g = clip01(dblToCol(g));
-  rgb->b = clip01(dblToCol(b));
+	double c, m, y, k, r, g, b;
+
+	c = colToDbl(color->c[0]);
+	m = colToDbl(color->c[1]);
+	y = colToDbl(color->c[2]);
+	k = colToDbl(color->c[3]);
+	r = (c+k<1.0) ? 1.0 - c - k : 0.0;
+	g = (m+k<1.0) ? 1.0 - m - k : 0.0;
+	b = (y+k<1.0) ? 1.0 - y - k : 0.0;
+	rgb->r = clip01(dblToCol(r));
+	rgb->g = clip01(dblToCol(g));
+	rgb->b = clip01(dblToCol(b));
 }
 
 void GfxDeviceCMYKColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) {
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to