summaryrefslogtreecommitdiff
path: root/base/gscspace.c
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2016-12-13 09:20:45 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2016-12-16 09:39:07 -0800
commit00dfdefe5d38871c0c67b08ede10a208b6897d10 (patch)
tree78f887d1d0278493d17c29218cd68e191845234a /base/gscspace.c
parent46de0c56a0132356084b320a9f7e4d2ac1396c1c (diff)
downloadghostpdl-00dfdefe5d38871c0c67b08ede10a208b6897d10.tar.gz
Bug 693307 Overprint issues
Remove the portions of code used to simulate the overprinting of CMYK and spot colorants while in an RGB device. This really can't work and we are doing a real separation compositor device for this process. The code parts removed only confuse understanding of the overprint compositor. Also fix problems related to Bug 693307 which were caused by some confusion in the code with regard to the overprint mode. Fix other issues related to the Ghent overprint tests where we were not handling properly the case of overprinting with a gray color when the output device was CMYK based. Finally there were multiple issues with the testing and setting of the overprint settings and the use of the effective overprint mode
Diffstat (limited to 'base/gscspace.c')
-rw-r--r--base/gscspace.c185
1 files changed, 9 insertions, 176 deletions
diff --git a/base/gscspace.c b/base/gscspace.c
index 07adb7302..7f50612fb 100644
--- a/base/gscspace.c
+++ b/base/gscspace.c
@@ -418,30 +418,12 @@ gx_spot_colors_set_overprint(const gs_color_space * pcs, gs_gstate * pgs)
{
gs_overprint_params_t params;
- if ((params.retain_any_comps = pgs->overprint))
- params.retain_spot_comps = true;
- pgs->effective_overprint_mode = 0;
- params.k_value = 0;
- params.blendspot = false;
- return gs_gstate_update_overprint(pgs, &params);
-}
-
-/*
- * Push an overprint compositor onto the current device indicating that
- * incoming CMYK values should be blended to simulate overprinting. This
- * allows us to get simulated overprinting of spot colors on standard CMYK
- * devices
- */
-int
-gx_simulated_set_overprint(const gs_color_space * pcs, gs_gstate * pgs)
-{
- gs_overprint_params_t params;
-
- if ((params.retain_any_comps = pgs->overprint))
+ if ((params.retain_any_comps = pgs->overprint)) {
params.retain_spot_comps = true;
+ params.retain_any_comps = false;
+ }
+ /* Only DeviceCMYK case can have overprint mode set to true */
pgs->effective_overprint_mode = 0;
- params.k_value = 0;
- params.blendspot = true;
return gs_gstate_update_overprint(pgs, &params);
}
@@ -545,66 +527,6 @@ check_cmyk_color_model_comps(gx_device * dev)
return process_comps;
}
-/* This is used in the RGB simulation overprint case */
-
-gx_color_index
-check_rgb_color_model_comps(gx_device * dev)
-{
- gx_device_color_info * pcinfo = &dev->color_info;
- int ncomps = pcinfo->num_components;
- int red_c, green_c, blue_c;
- const gx_cm_color_map_procs * pprocs;
- cm_map_proc_rgb((*map_rgb));
- frac frac_14 = frac_1 / 4;
- frac out[GX_DEVICE_COLOR_MAX_COMPONENTS];
- gx_color_index process_comps;
-
- /* check for the appropriate components */
- if ( ncomps < 3 ||
- (red_c = dev_proc(dev, get_color_comp_index)(
- dev,
- "Red",
- sizeof("Red") - 1,
- NO_COMP_NAME_TYPE )) < 0 ||
- red_c == GX_DEVICE_COLOR_MAX_COMPONENTS ||
- (green_c = dev_proc(dev, get_color_comp_index)(
- dev,
- "Green",
- sizeof("Green") - 1,
- NO_COMP_NAME_TYPE )) < 0 ||
- green_c == GX_DEVICE_COLOR_MAX_COMPONENTS ||
- (blue_c = dev_proc(dev, get_color_comp_index)(
- dev,
- "Blue",
- sizeof("Blue") - 1,
- NO_COMP_NAME_TYPE )) < 0 ||
- blue_c == GX_DEVICE_COLOR_MAX_COMPONENTS )
- return 0;
-
- /* check the mapping */
- pprocs = get_color_mapping_procs_subclass(dev);
- if ( pprocs == 0 ||
- (map_rgb = pprocs->map_rgb) == 0 )
- return 0;
-
- map_rgb_subclass(pprocs, dev, NULL, frac_14, frac_0, frac_0, out);
- if (!check_single_comp(red_c, frac_14, ncomps, out))
- return 0;
- map_rgb_subclass(pprocs, dev, NULL, frac_0, frac_14, frac_0, out);
- if (!check_single_comp(green_c, frac_14, ncomps, out))
- return 0;
- map_rgb_subclass(pprocs, dev, NULL, frac_0, frac_0, frac_14, out);
- if (!check_single_comp(blue_c, frac_14, ncomps, out))
- return 0;
-
- process_comps = ((gx_color_index)1 << red_c)
- | ((gx_color_index)1 << green_c)
- | ((gx_color_index)1 << blue_c);
- pcinfo->opmode = GC_CINFO_OPMODE_RGB_SET;
- pcinfo->process_comps = process_comps;
- return process_comps;
-}
-
/*
* This set_overprint method is unique. If overprint is true, overprint
* mode is set to 1, the process color model has DeviceCMYK behavior (see
@@ -672,7 +594,7 @@ int gx_set_overprint_cmyk(const gs_color_space * pcs, gs_gstate * pgs)
return gx_spot_colors_set_overprint(pcs, pgs);
/* correct for any zero'ed color components. But only if profiles
- match */
+ match AND pgs->overprint_mode is true */
if (pcs->cmm_icc_profile_data != NULL && output_profile != NULL) {
if (output_profile->hashcode ==
pcs->cmm_icc_profile_data->hashcode) {
@@ -680,9 +602,8 @@ int gx_set_overprint_cmyk(const gs_color_space * pcs, gs_gstate * pgs)
}
}
- pgs->effective_overprint_mode = 1;
pdc = gs_currentdevicecolor_inline(pgs);
- if (color_is_set(pdc) && profile_ok) {
+ if (color_is_set(pdc) && profile_ok && pgs->overprint_mode == 1) {
gx_color_index nz_comps, one, temp;
int code;
int num_colorant[4], k;
@@ -733,98 +654,10 @@ int gx_set_overprint_cmyk(const gs_color_space * pcs, gs_gstate * pgs)
params.retain_any_comps = true;
params.retain_spot_comps = false;
params.drawn_comps = drawn_comps;
- params.k_value = 0;
- params.blendspot = false;
- return gs_gstate_update_overprint(pgs, &params);
-}
-
-/* This is used for the case where we have an RGB based device, but we want
- to simulate CMY overprinting. Color management is pretty much thrown out
- the window when doing this. */
+ /* We are in CMYK, the profiles match and overprint is true. Set effective
+ overprint mode to overprint mode */
+ pgs->effective_overprint_mode = pgs->overprint_mode;
-int gx_set_overprint_rgb(const gs_color_space * pcs, gs_gstate * pgs)
-{
- gx_device * dev = pgs->device;
- gx_device_color_info * pcinfo = (dev == 0 ? 0 : &dev->color_info);
- gx_color_index drawn_comps = 0;
- gs_overprint_params_t params;
- gx_device_color *pdc;
-
- /* check if color model behavior must be determined. This is why we
- need the GX_CINFO_OPMODE_RGB and GX_CINFO_OPMODE_RGB_SET.
- We only need to do this once */
- if (dev) {
- if (pcinfo->opmode == GX_CINFO_OPMODE_RGB)
- drawn_comps = check_rgb_color_model_comps(dev);
- else
- drawn_comps = pcinfo->process_comps;
- }
- if (drawn_comps == 0)
- return gx_spot_colors_set_overprint(pcs, pgs);
-
- /* correct for any zero'ed color components. Note that matching of
- ICC profiles as a condition is not possible here, since the source
- will be CMYK and the destination RGB */
- pgs->effective_overprint_mode = 1;
- pdc = gs_currentdevicecolor_inline(pgs);
- params.k_value = 0;
- params.blendspot = false;
- if (color_is_set(pdc)) {
- gx_color_index nz_comps, one, temp;
- int code;
- int num_colorant[3], k;
- bool colorant_ok;
-
- dev_color_proc_get_nonzero_comps((*procp));
-
- procp = pdc->type->get_nonzero_comps;
- if (pdc->ccolor_valid) {
- /* If we have the source colors, then use those in making the
- decision as to which ones are non-zero. Then we avoid
- accidently looking at small values that get quantized to zero
- Note that to get here in the code, the source color data color
- space has to be CMYK. Trick is that we do need to worry about
- the RGB colorant order on the target device */
- num_colorant[0] = (dev_proc(dev, get_color_comp_index))\
- (dev, "Red", strlen("Red"), NO_COMP_NAME_TYPE);
- num_colorant[1] = (dev_proc(dev, get_color_comp_index))\
- (dev, "Green", strlen("Green"), NO_COMP_NAME_TYPE);
- num_colorant[2] = (dev_proc(dev, get_color_comp_index))\
- (dev, "Blue", strlen("Blue"), NO_COMP_NAME_TYPE);
- nz_comps = 0;
- one = 1;
- colorant_ok = true;
- for (k = 0; k < 3; k++) {
- if (pdc->ccolor.paint.values[k] != 0) {
- if (num_colorant[k] == -1) {
- colorant_ok = false;
- } else {
- temp = one << num_colorant[k];
- nz_comps = nz_comps | temp;
- }
- }
- }
- /* Check for the case where we have a K component. In this case
- we need to fudge things a bit. And we will end up needing
- to do some special stuff in the overprint compositor's rect
- fill to reduce the destination RGB values of the ones
- that we are not blowing away with the source values. Those
- that have the source value will have already been reduced */
- params.k_value = (unsigned short) (pdc->ccolor.paint.values[3] * 256);
- /* For some reason we don't have one of the standard colorants */
- if (!colorant_ok) {
- if ((code = procp(pdc, dev, &nz_comps)) < 0)
- return code;
- }
- } else {
- if ((code = procp(pdc, dev, &nz_comps)) < 0)
- return code;
- }
- drawn_comps &= nz_comps;
- }
- params.retain_any_comps = true;
- params.retain_spot_comps = false;
- params.drawn_comps = drawn_comps;
return gs_gstate_update_overprint(pgs, &params);
}