Bug 690314 - Color conversion to b&w not correct in PCL
Summary: Color conversion to b&w not correct in PCL
Status: NOTIFIED FIXED
Alias: None
Product: GhostPCL
Classification: Unclassified
Component: PCL interpreter (show other bugs)
Version: master
Hardware: PC Windows 2000
: P2 normal
Assignee: Ray Johnston
URL:
Keywords: bountiable
Depends on:
Blocks:
 
Reported: 2009-03-03 00:00 UTC by norbert.janssen
Modified: 2009-04-30 05:54 UTC (History)
1 user (show)

See Also:
Customer: 661
Word Size: ---


Attachments
PCL-XL testfile from Quality Logic (31.89 KB, application/octet-stream)
2009-03-03 00:01 UTC, norbert.janssen
Details
rectangle_not_filled_with_light_grey.xl (196 bytes, application/octet-stream)
2009-03-03 05:23 UTC, norbert.janssen
Details
gdevbit.c (26.66 KB, text/plain)
2009-03-16 04:09 UTC, norbert.janssen
Details
bitmono.ras (62.53 KB, application/octet-stream)
2009-03-16 04:11 UTC, norbert.janssen
Details
pngcolor.png (3.40 KB, image/png)
2009-03-16 04:12 UTC, norbert.janssen
Details
pngmono.png (532 bytes, image/png)
2009-03-16 04:13 UTC, norbert.janssen
Details
690314-bit.pbm (61.69 KB, application/octet-stream)
2009-04-06 11:21 UTC, Ray Johnston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description norbert.janssen 2009-03-03 00:00:28 UTC
When printing the C101.xl file (from the Quality Logic CET pcl6 testsuite) with
the following commandline (standard build with the latest trunk version 9518,
with Cygwin: cd main; make debug):

obj/pcl6 -sDEVICE=x11 C101.xl
obj/pcl6 -sDEVICE=x11mono C101.xl

I notice that the contents of the graphics on the third page is rendered
differently.
On the x11 device, the contents of the graphics is filled with a light blue/green.
On the x11mono device, the contents of the graphics is filled with black.
Comment 1 norbert.janssen 2009-03-03 00:01:56 UTC
Created attachment 4823 [details]
PCL-XL testfile from Quality Logic
Comment 2 norbert.janssen 2009-03-03 05:23:56 UTC
Created attachment 4824 [details]
rectangle_not_filled_with_light_grey.xl

simplified testfile (PCL-XL), 1 page with a rounded_rectangle on it.
Interior of rectangle should be light-grey (from RGB blue) when printed with
x11mono device.
On x11 device it's light-blue!!
Comment 3 Henry Stiles 2009-03-15 15:37:15 UTC
The X11 devices are developer tools and don't undergo careful testing, I don't
know of any customers using them.  The pbmraw device seems to work okay and I
guess the other mono devices are working, so I am changing this to P4.
Comment 4 norbert.janssen 2009-03-16 04:07:42 UTC
I tried with the pngmono device and this indeed did print ok.
However, our own device (derived from the gdevbit.c (mono) does not.
If compiling with the attached gdevbit.c (which generates a sunrasterfile), you
see that the fill is with black i.s.o. a halftone.
Add the $(DD)bit.dev to the DEVICES_DEVS (in pcl6_gcc.mak) and using the
following commandline:

main/obj/pcl6 -sDEVICE=bit sOutputFile=ras_%d.ras c1.xl you get the output as in
attached rasterfile (bitmono.ras) viewable with irfanview on a PC.

For reference I attached also the png16m and pngmono output.
Comment 5 norbert.janssen 2009-03-16 04:09:49 UTC
Created attachment 4845 [details]
gdevbit.c

modified gdevbit.c (to generate a sunraster file)
Comment 6 norbert.janssen 2009-03-16 04:11:33 UTC
Created attachment 4846 [details]
bitmono.ras

resulting sunrasterfile from command:

main/obj/pcl6 -sDEVICE=bit -sOutputFile=bitmono.ras c1.xl
Comment 7 norbert.janssen 2009-03-16 04:12:40 UTC
Created attachment 4847 [details]
pngcolor.png

resulting color.png  with command:

main/obj/pcl -sDEVICE=png16m -sOutputFile=pngcolor.png c1.xl
Comment 8 norbert.janssen 2009-03-16 04:13:47 UTC
Created attachment 4848 [details]
pngmono.png

resulting mono.png file with command:

main/obj/pcl6 -sDEVICE=pngmono -sOutputFile=pngmono.png c1.xl
Comment 9 Henry Stiles 2009-03-18 20:09:47 UTC
I am copying in Ray because your gdevbit.c does not have support for his latest
changes, I don't know if that is an issue.  As for the bit device, you can
simply put a pnm header on the bit output.  "P4" followed by the width and
height of the bitmap.  Have a look at the output of -sDEVICE=pbmraw.  Finally
this doesn't look like a pcl problem so I'll assign back to support, but make it
P2 since it looks like a real problem.
Comment 10 Ray Johnston 2009-04-06 11:21:03 UTC
Created attachment 4903 [details]
690314-bit.pbm

I cannot reproduce the problem. It looks to me like the bit device is working
correctly.

This file was created (from attachment #4824 [details]) with:

obj/pcl6.exe  -r72 -dGrayValues=2 -sDEVICE=bit -sOutputFile=x.bit
bug_690314.pxl
cat header.pbm x.bit > 690314-bit.pbm

Where 'header.pbm' contains the three lines:
P4
595 842
1
Comment 11 Ray Johnston 2009-04-07 08:55:14 UTC
Norbert confirmed that the colors are correct as I tested, but he found that the
problem only occurs in clist mode. This test shows the wrong colors:

obj/pcl6.exe -sDEVICE=pbmraw -dMaxBitmap=10000 -sOutputFile=x.pbm bug_690314.pxl

Adding -dMaxBitmap=10000 forces banding mode. Assigning to myself as a clist
issue.

Thanks to Norbert for figuring out what allowed this to be reproduced.
Comment 12 Ray Johnston 2009-04-08 14:19:17 UTC
This was broken by the rev 2925 DeviceN commit (massive collection with NO
detailed reasoning).

The palette colors should not be set up on the basis of color_info.polarity
since even when black is color 1 it is technically an 'additive' colorspace
("0 setgray" is black and "1 setgray" is white).

All of the other places that set this were correct. This was only broken in
clist mode since page buffer mode set this up from base/gdevmr1.c in
"mem_mono_strip_copy_rop" correctly.

The patch:

--- base/gdevmem.c      (revision 9604)
+++ base/gdevmem.c      (working copy)
@@ -168,9 +168,11 @@
        dev->cached_colors = target->cached_colors;
     }
     if (dev->color_info.depth == 1) {
-       gdev_mem_mono_set_inverted(dev,
-                                  (target == 0 || 
-                                    dev->color_info.polarity ==
GX_CINFO_POLARITY_SUBTRACTIVE));
+       gx_color_value cv[3];
+
+       cv[0] = cv[1] = cv[2] = 0;
+       gdev_mem_mono_set_inverted(dev, (target == 0 ||
+                                  (*dev_proc(dev, map_rgb_color))((gx_device
*)dev, cv) != 0));
     }
     check_device_separable((gx_device *)dev);
     gx_device_fill_in_procs((gx_device *)dev);

is committed in rev 9621.