[gs-commits] ghostpdl branch, master, updated. ghostpdl-9.02-518-geb6b631
Till Kamppeter
till at ghostscript.com
Mon Aug 15 12:18:40 UTC 2011
The ghostpdl branch, master has been updated
via eb6b63157d90bed5df4b5dd134b5581b4a38ae39 (commit)
from 28f0da42cbffd79ba747a3e14a899dda5e7a4bd7 (commit)
----------------------------------------------------------------------
commit eb6b63157d90bed5df4b5dd134b5581b4a38ae39
Author: Till Kamppeter <till.kamppeter at gmail.com>
Date: Mon Aug 15 14:04:17 2011 +0200
Let the CUPS Raster output device generate RGBW as defined in the CUPS documentation
The CUPS Raster output device ("cups") has an RGBW output color
space. This was intended to produce standard RGB plus an extra channel
which marks true black pixels by being 0 and for all non-black pixels
having all bits set to 1. This mode is designed to control the use of
black ink or toner for black text in printed documents.
The RGBW output of Ghostscript's CUPS Raster output device was
actually inverted CMYK, an RGBW which is known to be used by
projectors.
The HPLIP printer drivers worked around this bug being able to
understand both modes correctly and so printouts on HP printers were
correct before, too, but we need to follow the documentation of CUPS,
so that if other printer manufacturers/driver developers make use of
the RGBW mode get correct results.
This finally fixes bug 691922.
CUPS documentation:
http://www.cups.org/documentation.php/doc-1.5/spec-raster.html
Section: Pixel Value Coding, CUPS_CSPACE_RGBW
diff --git a/gs/cups/gdevcups.c b/gs/cups/gdevcups.c
index fc2b13b..93058ed 100644
--- a/gs/cups/gdevcups.c
+++ b/gs/cups/gdevcups.c
@@ -1182,16 +1182,17 @@ cups_map_cmyk(gx_device *pdev, /* I - Device info */
case CUPS_CSPACE_RGB :
case CUPS_CSPACE_RGBW :
- if (cups->header.cupsColorSpace == CUPS_CSPACE_RGBW) {
- c0 = c;
- c1 = m;
- c2 = y;
- c3 = k;
- } else {
- c0 = c + k;
- c1 = m + k;
- c2 = y + k;
- }
+ c0 = c + k;
+ c1 = m + k;
+ c2 = y + k;
+ if (cups->header.cupsColorSpace == CUPS_CSPACE_RGBW)
+ if (k >= frac_1) {
+ c0 = frac_1;
+ c1 = frac_1;
+ c2 = frac_1;
+ c3 = frac_1;
+ } else
+ c3 = 0;
if (c0 < 0)
c0 = 0;
@@ -1212,11 +1213,12 @@ cups_map_cmyk(gx_device *pdev, /* I - Device info */
out[2] = frac_1 - (frac)cups->Density[c2];
if (cups->header.cupsColorSpace == CUPS_CSPACE_RGBW) {
- if (c3 < 0)
- c3 = 0;
- else if (c3 > frac_1)
- c3 = frac_1;
- out[3] = frac_1 - (frac)cups->Density[c3];
+ if (c3 == 0)
+ out[3] = frac_1;
+ else if (c3 == frac_1)
+ out[3] = 0;
+ else
+ out[3] = frac_1;
}
break;
@@ -2034,10 +2036,15 @@ cups_map_color_rgb(gx_device *pdev,/* I - Device info */
* cups->DecodeLUT actually maps to RGBW, not CMYK...
*/
- k = cups->DecodeLUT[c3];
- c = cups->DecodeLUT[c0] + k - gx_max_color_value;
- m = cups->DecodeLUT[c1] + k - gx_max_color_value;
- y = cups->DecodeLUT[c2] + k - gx_max_color_value;
+ if (c3 == 0) {
+ c = 0;
+ m = 0;
+ y = 0;
+ } else {
+ c = cups->DecodeLUT[c0];
+ m = cups->DecodeLUT[c1];
+ y = cups->DecodeLUT[c2];
+ }
if (c > gx_max_color_value)
prgb[0] = gx_max_color_value;
@@ -2282,20 +2289,20 @@ cups_map_rgb_color(gx_device *pdev,/* I - Device info */
switch (cups->header.cupsBitsPerColor)
{
default :
- i = 0x0e;
+ i = 0x00;
break;
case 2 :
- i = 0xfc;
+ i = 0x00;
break;
case 4 :
- i = 0xfff0;
+ i = 0x0000;
break;
case 8 :
- i = 0xffffff00;
+ i = 0x00000000;
break;
#ifdef GX_COLOR_INDEX_TYPE
case 16 :
- i = 0xffffffffffff0000;
+ i = 0x0000000000000000;
break;
#endif /* GX_COLOR_INDEX_TYPE */
}
Summary of changes:
gs/cups/gdevcups.c | 55 +++++++++++++++++++++++++++++----------------------
1 files changed, 31 insertions(+), 24 deletions(-)
More information about the gs-commits
mailing list