summaryrefslogtreecommitdiff
path: root/base/gsicc_manage.c
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2021-05-27 22:04:43 -0700
committerMichael Vrhel <michael.vrhel@artifex.com>2021-05-28 12:41:58 -0700
commita717276b18765b86c6f55749f559d210b63084d4 (patch)
tree6fb0f1922699f6dca5955d2b15a0f10236c53be5 /base/gsicc_manage.c
parentd0c949ed3acfecde5c0b39be8b6e0358192c42a6 (diff)
downloadghostpdl-a717276b18765b86c6f55749f559d210b63084d4.tar.gz
Expand and alter support for NCLR ICC profile and color names
This commit affects the capabilities of the psdcmyk device and the tiffsep device. Much of the discussion below is now in the documentation, but is included here for completeness. Normally with an NCLR ICC profile you can specify the colorants using -sICCOutputColors="Cyan, Magenta, Yellow, Black, Orange, Violet" for example for a 6CLR ICC profile. Now we allow additional names beyond those of the ICC profile component count. In this case, those names will be installed into the tiffsep or psdcmyk device list of colors, following the ICC profile colors. The number of spot colors (those that go beyond the standard CMYK colors) allowed by tiffsep or psdcmyk can be set using -dMaxSpots=#. The default value for this is currently set to 10 (GS_SOFT_MAX_SPOTS). As an example consider the case where we wish to use a 6CLR ICC profile that includes Orange and Violet, but need the device to include a specialty color such as Varnish, which does not appear in the document and is not handled by the 6CLR ICC profile. In addition, we desire to allow one more spot color of the document to come through to our device. For this case using -sICCOutputColors="Cyan, Magenta, Yellow, Black, Orange, Violet, Varnish" -dMaxSpots= 4 -sOutputICCProfile=My_6CLR_Profile.icc would provide the desired outcome. Note that it is up to the device or through the use of -sNamedProfile to involve the setting of any values in the Varnish channel. However, if an All color value is encountered in the document, the Varnish component will have its value set as will the Orange and Violet components (Likewise if a spot color named Varnish is encountered in the document the Varnish component will be used for the values). Finally this commit adds a debug option --debug=clist-color which will provide clist writing and reading debug information for the reading and writing of devn color values to and from the clist. This is helpful to debug cases where the pdf14 color model changes due to group color space changes, which can be difficult to track down when there is a mismatch in the read and write of the color values. Thanks to Ray Johnston for his help on much of this effort.
Diffstat (limited to 'base/gsicc_manage.c')
-rw-r--r--base/gsicc_manage.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/base/gsicc_manage.c b/base/gsicc_manage.c
index 4586441a5..1c3fa91a5 100644
--- a/base/gsicc_manage.c
+++ b/base/gsicc_manage.c
@@ -1586,8 +1586,15 @@ gsicc_set_device_profile_colorants(gx_device *dev, char *name_str)
char temp_str[DEFAULT_ICC_COLORANT_LENGTH+2];
/* If names are already set then we do not want to set default ones */
- if (profile_struct->spotnames != NULL)
- return 0;
+ if (profile_struct->spotnames != NULL) {
+ /* Check if we have at least as many spot names
+ as there are channels in the proFfile */
+ if (num_comps > profile_struct->spotnames->count) {
+ gs_warn("ICC profile colorant names count insufficient");
+ return_error(gs_error_rangecheck);
+ } else
+ return 0;
+ }
free_str = true;
/* Assume first 4 are CMYK */
@@ -1933,7 +1940,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
{
cmm_profile_t *icc_profile;
stream *str;
- int code;
+ int code = 0;
/* This is slightly silly, we have a device method for 'get_profile' we really ought to
* have one for 'set_profile' as well. In its absence, make sure we are setting the profile
@@ -2047,7 +2054,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
break;
default:
/* NCLR Profile. Set up default colorant names */
- gsicc_set_device_profile_colorants(pdev, NULL);
+ code = gsicc_set_device_profile_colorants(pdev, NULL);
break;
}
if_debug1m(gs_debug_flag_icc, mem, "[icc] Profile data CS is %d\n",
@@ -2055,7 +2062,7 @@ gsicc_set_device_profile(gx_device * pdev, gs_memory_t * mem,
} else
return gs_rethrow(-1, "cannot find device profile");
}
- return 0;
+ return code;
}
/* Set the icc profile in the gs_color_space object */