Revised ix for 687718 The tiffsep device fails when thesize of gx_color_index is 32 bits
"Dan Coby" <[email protected]> Wed, 29 Sep 2004 16:04:59 -0700
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
This is a revision to the previous posting on this topic. Russell has pointed out that I incorrectly posted changes to Drivers.htm when I meant to present the changes in Devices.htm Log message: Fix for 687718 The tiffsep device fails when the size of gx_color_index is 32 bits DETAILS: The comments on bug 687705 "Compile of 8.31 fails on OS/2" point out that the tiffsep device fails during device initialization if the size of gx_color_index is 32 bits. This is due to a recent change which made the default number of components for this device equal to 8. This works if the size of gx_color_index is 64 bits. But it fails with 32 bits. This fix changes the default number of components for this device to be based upon the size of gx_color_index. It also changes the psdcmyk device to use the same logic for its default number of components. This fix also includes changes to doc/Devices.htm which explains that the number of components will differ based upon the size of gx_color_index (and a link giving more details on gx_color_index). More information about the parameters for the tiffsep device is given including an example command line. Dan _______________________________________________ gs-code-review mailing list [email protected] http://www.ghostscript.com/mailman/listinfo/gs-code-review
tiffsep.txt
(text/plain, 7.5 KB)
Index: src/gdevtsep.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevtsep.c,v
retrieving revision 1.4
diff -u -r1.4 gdevtsep.c
--- src/gdevtsep.c 20 Sep 2004 21:42:12 -0000 1.4
+++ src/gdevtsep.c 29 Sep 2004 22:57:19 -0000
@@ -381,18 +381,24 @@
{ 0 } /* separation files */
/*
+ * Select the default number of components based upon the number of bits
+ * that we have in a gx_color_index
+ */
+#define NC ((sizeof(gx_color_index) <= 8) ? sizeof(gx_color_index) : 8)
+
+/*
* TIFF device with CMYK process color model and spot color support.
*/
private const gx_device_procs spot_cmyk_procs = device_procs;
const tiffsep_device gs_tiffsep_device =
{
- tiffsep_device_body(spot_cmyk_procs, "tiffsep", 8, GX_CINFO_POLARITY_SUBTRACTIVE, 64, MAX_COLOR_VALUE, MAX_COLOR_VALUE, "DeviceCMYK"),
+ tiffsep_device_body(spot_cmyk_procs, "tiffsep", NC, GX_CINFO_POLARITY_SUBTRACTIVE, NC * 8, MAX_COLOR_VALUE, MAX_COLOR_VALUE, "DeviceCMYK"),
/* devn_params specific parameters */
- { 8, /* Bits per color - must match ncomp, depth, etc. above */
+ { 8, /* Bits per color - must match ncomp, depth, etc. above */
DeviceCMYKComponents, /* Names of color model colorants */
4, /* Number colorants for CMYK */
- 8, /* MaxSeparations: our current limit is 8 bytes */
+ NC, /* MaxSeparations: our current limit is 8 bytes */
{0}, /* SeparationNames */
{0}, /* SeparationOrder names */
{0, 1, 2, 3, 4, 5, 6, 7 } /* Initial component SeparationOrder */
@@ -400,6 +406,8 @@
{ true }, /* equivalent CMYK colors for spot colors */
};
+#undef NC
+
/*
* The following procedures are used to map the standard color spaces into
* the color components for the tiffsep device.
Index: src/gdevpsd.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpsd.c,v
retrieving revision 1.17
diff -u -r1.17 gdevpsd.c
--- src/gdevpsd.c 15 Sep 2004 11:46:41 -0000 1.17
+++ src/gdevpsd.c 29 Sep 2004 22:57:20 -0000
@@ -245,6 +245,12 @@
};
/*
+ * Select the default number of components based upon the number of bits
+ * that we have in a gx_color_index
+ */
+#define NC ((sizeof(gx_color_index) <= 8) ? sizeof(gx_color_index) : 8)
+
+/*
* PSD device with CMYK process color model and spot color support.
*/
private const gx_device_procs spot_cmyk_procs
@@ -252,7 +258,7 @@
const psd_device gs_psdcmyk_device =
{
- psd_device_body(spot_cmyk_procs, "psdcmyk", 4, GX_CINFO_POLARITY_SUBTRACTIVE, 32, 255, 255, "DeviceCMYK"),
+ psd_device_body(spot_cmyk_procs, "psdcmyk", NC, GX_CINFO_POLARITY_SUBTRACTIVE, NC * 8, 255, 255, "DeviceCMYK"),
/* devn_params specific parameters */
{ 8, /* Bits per color - must match ncomp, depth, etc. above */
DeviceCMYKComponents, /* Names of color model colorants */
@@ -267,6 +273,8 @@
psd_DEVICE_CMYK, /* Color model */
};
+#undef NC
+
/*
* The following procedures are used to map the standard color spaces into
* the color components for the psdrgb device.
Index: doc/Devices.htm
===================================================================
RCS file: /cvs/ghostscript/gs/doc/Devices.htm,v
retrieving revision 1.81
diff -u -r1.81 Devices.htm
--- doc/Devices.htm 28 Aug 2004 21:52:56 -0000 1.81
+++ doc/Devices.htm 29 Sep 2004 22:57:21 -0000
@@ -335,6 +335,9 @@
<dd>Produces 32-bit CMYK output (8 bits per component).
<dt><b><tt>tiffsep</tt></b>
<dd>
+The tiffsep device is a CMYK device with support for spot colors.
+
+<p>
The tiffsep device creates multiple output files. The device creates a single
32 bit composite CMYK file (tiff32nc format) and multiple tiffgray files.
A tiffgray file is created for each separation.
@@ -344,8 +347,9 @@
CMYK data. This data is based upon the CMYK data within the file plus
an equivalent CMYK color for each spot colors which is present. The equivalent
CMYK color for each spot colors is determined using the alternate tint transform
-function specified in Separation and DeviceN color spaces. Since
-this file is created based upon having color planes for each colorant, the
+function specified in Separation and DeviceN color spaces. The basic purpose of
+this file is to present the overall appearance of the input data. Since
+this file is created based upon having separate color planes for each colorant, the
file will correctly represent the appearance of overprinting with spot colors.
<p>
@@ -366,17 +370,11 @@
spot color numbers are not affected by the SeparationOrder parameter.
<p>
-The names of spot colors may be specified via the SeparationColorNames device
-parameters. Or the tiffsep device will automatically recognize spot color
-names if <b><tt>-dMaxSeparations=8</tt></b> is specified on the
-command line.
-
-<p>
-If only a subset of the colorants for a file is desired then the separations
-to be output can be selected via the SeparationOrder
-device parameter. When colorants are selected via the
-SeparationOrder parameter, the composite CMYK output contains
-the equivalent CMYK data only for the selected colorants.
+The tiffsep device will automatically recognize spot color names.
+The SeparationColorNames device parameter can also be used to specify
+the names of spot colors. Ghostcript automatically assumes that Cyan, Magenta,
+Yellow, and Black are present as colorants for the tiffsep device. Thus it is
+not necessary to specify these colorants explicitly.
<p>
The tiffsep device also prints the names of any spot colors
@@ -387,18 +385,41 @@
the names of spot colors with a document.
<p>
-Ghostscript currently limits the size of a pixel to 64 bits.
+If only a subset of the colorants for a file is desired then the separations
+to be output can be selected via the SeparationOrder
+device parameter. When colorants are selected via the
+SeparationOrder parameter, the composite CMYK output contains
+the equivalent CMYK data only for the selected colorants. For example, if the
+source file has spot colors named orange, green, and purple, the
+following command line will create separations for the cyan, orange, and
+purple colorants. The composite CMYK file will only represent the appearance
+of the cyan, orange, and purple colorants.
+
+<blockquote>
+<kbd>gs -sDEVICE=tiffsep -sOutputFile=foo.tif -c "<< SeparationColorNames
+[ /orange /green /purple ] /SeparationOrder [ /cyan /orange /purple ] >>
+setpagedevice" -f foo.ps</kbd>
+</blockquote>
+
+<p>
+Ghostscript currently limits the size of a pixel to 64 bits with most compilers.
+(See the description of gx_color_index in <a href="Drivers.htm#Types">Types</a>.)
Since the tiffsep device uses 8 bits per colorant, the device can handle
a maximum of 8 colorants per pass. However it is possible to
handle more than 8 colorants by doing multiple passes. For each
-pass after the first one, the names of all of the separations need
+pass after the first one, the names of all of the spot colors need
to be specified via the SeparationColorNames parameter and the
names of the desired separations need to be specified via the
SeparationOrder parameter. It is
possible to create an overall CMYK composite for more than 8
colorants by then adding together (via an external application like
imagemagick) the composite CMYK output files from the individual
-Ghostscript passes.
+Ghostscript passes. For those compilers which only support a 32 bit value
+for gx_color_index, only 4 separations may be generated per pass and the
+SeparationColorNames and SeparationOrder device parameters
+must be used to obtain separations for spot colors.
+
+<p>
</dl>
</blockquote>