summaryrefslogtreecommitdiff
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
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
-rw-r--r--base/gdevp14.c15
-rw-r--r--base/gdevp14.h1
-rw-r--r--base/gscdevn.c26
-rw-r--r--base/gscolor.c18
-rw-r--r--base/gscsepr.c13
-rw-r--r--base/gscspace.c185
-rw-r--r--base/gsicc.c38
-rw-r--r--base/gsovrc.c127
-rw-r--r--base/gsovrc.h13
-rw-r--r--base/gstrans.h2
-rw-r--r--base/gxblend.h4
-rw-r--r--base/gxblend1.c4
-rw-r--r--base/gxcmap.c8
-rw-r--r--base/gxcspace.h6
-rw-r--r--base/gxdevcli.h7
-rw-r--r--base/gxoprect.c17
-rw-r--r--base/gxoprect.h3
17 files changed, 102 insertions, 385 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c
index 3c76de3b6..bec5a07c0 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -1064,7 +1064,6 @@ pdf14_pop_transparency_group(gs_gstate *pgs, pdf14_ctx *ctx,
pdf14_device *pdev = (pdf14_device *)dev;
bool overprint = pdev->overprint;
gx_color_index drawn_comps = pdev->drawn_comps;
- bool blendspot = pdev->blendspot;
bool nonicc_conversion = true;
nos_num_color_comp = nos->parent_color_info_procs->num_components - nos->num_spots;
@@ -1254,14 +1253,14 @@ pdf14_pop_transparency_group(gs_gstate *pgs, pdf14_ctx *ctx,
pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1, nos->n_chan,
nos->parent_color_info_procs->isadditive,
nos->parent_color_info_procs->parent_blending_procs,
- false, drawn_comps, false, ctx->memory, dev);
+ false, drawn_comps, ctx->memory, dev);
}
} else {
/* Group color spaces are the same. No color conversions needed */
if (x0 < x1 && y0 < y1)
pdf14_compose_group(tos, nos, maskbuf, x0, x1, y0, y1, nos->n_chan,
ctx->additive, pblend_procs, overprint,
- drawn_comps, blendspot, ctx->memory, dev);
+ drawn_comps, ctx->memory, dev);
}
exit:
ctx->stack = nos;
@@ -3202,8 +3201,6 @@ static void
pdf14_set_params(gs_gstate * pgs, gx_device * dev,
const gs_pdf14trans_params_t * pparams)
{
- pdf14_device * p14dev = (pdf14_device *)dev;
-
if_debug0m('v', dev->memory, "[v]pdf14_set_params\n");
if (pparams->changed & PDF14_SET_BLEND_MODE)
pgs->blend_mode = pparams->blend_mode;
@@ -3217,8 +3214,6 @@ pdf14_set_params(gs_gstate * pgs, gx_device * dev,
pgs->overprint = pparams->overprint;
if (pparams->changed & PDF14_SET_OVERPRINT_MODE)
pgs->overprint_mode = pparams->overprint_mode;
- if (pparams->changed & PDF14_SET_OVERPRINT_BLEND)
- p14dev->blendspot = pparams->blendspot;
pdf14_set_marking_params(dev, pgs);
}
@@ -3759,7 +3754,6 @@ pdf14_create_compositor(gx_device * dev, gx_device * * pcdev,
values around a fair amount. Hence the forced assignement here.
See gx_spot_colors_set_overprint in gscspace for issues... */
const gs_overprint_t * op_pct = (const gs_overprint_t *) pct;
- p14dev->blendspot = op_pct->params.blendspot;
if (op_pct->params.retain_any_comps && !op_pct->params.retain_spot_comps) {
p14dev->drawn_comps = op_pct->params.drawn_comps;
} else {
@@ -5824,7 +5818,6 @@ gs_pdf14_device_push(gs_memory_t *mem, gs_gstate * pgs,
code = dev_proc((gx_device *) p14dev, open_device) ((gx_device *) p14dev);
*pdev = (gx_device *) p14dev;
pdf14_set_marking_params((gx_device *)p14dev, pgs);
- p14dev->blendspot = false;
p14dev->trans_group_parent_cmap_procs = NULL;
/* In case we have alphabits set */
p14dev->color_info.anti_alias = target->color_info.anti_alias;
@@ -6155,8 +6148,6 @@ c_pdf14trans_write(const gs_composite_t * pct, byte * data, uint * psize,
put_value(pbuf, pparams->overprint);
if (pparams->changed & PDF14_SET_OVERPRINT_MODE)
put_value(pbuf, pparams->overprint_mode);
- if (pparams->changed & PDF14_SET_OVERPRINT_BLEND)
- put_value(pbuf, pparams->blendspot);
break;
case PDF14_PUSH_TRANS_STATE:
break;
@@ -6340,8 +6331,6 @@ c_pdf14trans_read(gs_composite_t * * ppct, const byte * data,
read_value(data, params.overprint);
if (params.changed & PDF14_SET_OVERPRINT_MODE)
read_value(data, params.overprint_mode);
- if (params.changed & PDF14_SET_OVERPRINT_BLEND)
- read_value(data, params.blendspot);
break;
}
code = gs_create_pdf14trans(ppct, &params, mem);
diff --git a/base/gdevp14.h b/base/gdevp14.h
index 52a1bd52d..bfe6d1854 100644
--- a/base/gdevp14.h
+++ b/base/gdevp14.h
@@ -226,7 +226,6 @@ typedef struct pdf14_device_s {
bool text_knockout;
bool overprint;
bool overprint_mode;
- bool blendspot;
gx_color_index drawn_comps; /* Used for overprinting. Passed from overprint compositor */
gx_device * pclist_device;
bool free_devicen; /* Used to avoid freeing a deviceN parameter from target clist device */
diff --git a/base/gscdevn.c b/base/gscdevn.c
index fed3d0fa9..cc2e5e51c 100644
--- a/base/gscdevn.c
+++ b/base/gscdevn.c
@@ -668,10 +668,7 @@ gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_gstate * pgs)
{
gs_devicen_color_map * pcmap = &pgs->color_component_map;
int code;
- gx_device *dev = pgs->device;
- cmm_dev_profile_t *dev_profile;
- dev_proc(dev, get_profile)(dev, &(dev_profile));
/* It is possible that the color map information in the graphic state
is not current due to save/restore and or if we are coming from
a color space that is inside a PatternType 2 */
@@ -681,17 +678,11 @@ gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_gstate * pgs)
if (pcmap->use_alt_cspace) {
const gs_color_space_type* base_type = pcs->base_space->type;
- if (dev_profile->sim_overprint &&
- dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE &&
- !gx_device_must_halftone(dev))
- return gx_simulated_set_overprint(pcs->base_space, pgs);
- else {
- /* If the base space is DeviceCMYK, handle overprint as DeviceCMYK */
- if ( base_type->index == gs_color_space_index_DeviceCMYK )
- return base_type->set_overprint( pcs->base_space, pgs );
- else
- return gx_spot_colors_set_overprint( pcs->base_space, pgs);
- }
+ /* If the base space is DeviceCMYK, handle overprint as DeviceCMYK */
+ if ( base_type->index == gs_color_space_index_DeviceCMYK )
+ return base_type->set_overprint( pcs->base_space, pgs );
+ else
+ return gx_spot_colors_set_overprint( pcs->base_space, pgs);
}
else {
gs_overprint_params_t params;
@@ -701,17 +692,14 @@ gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_gstate * pgs)
params.retain_spot_comps = false;
params.drawn_comps = 0;
- params.k_value = 0;
- /* We should not have to blend if we don't need the alternate tint transform */
- params.blendspot = false;
for (i = 0; i < ncomps; i++) {
- int mcomp = pcmap->color_map[i];
-
+ int mcomp = pcmap->color_map[i];
if (mcomp >= 0)
gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
}
}
+ /* Only DeviceCMYK can use overprint mode */
pgs->effective_overprint_mode = 0;
return gs_gstate_update_overprint(pgs, &params);
}
diff --git a/base/gscolor.c b/base/gscolor.c
index 6e5703711..3615b5292 100644
--- a/base/gscolor.c
+++ b/base/gscolor.c
@@ -215,8 +215,12 @@ gx_set_device_color_1(gs_gstate * pgs)
{
gs_color_space *pcs;
- gs_setoverprint(pgs, false);
- gs_setoverprintmode(pgs, 0);
+ /* Get the current overprint setting so that it can be properly restored.
+ No need to fool with the mode */
+ int overprint = pgs->overprint;
+
+ if (overprint)
+ gs_setoverprint(pgs, false);
pcs = gs_cspace_new_DeviceGray(pgs->memory);
if (pcs) {
gs_setcolorspace(pgs, pcs);
@@ -227,12 +231,10 @@ gx_set_device_color_1(gs_gstate * pgs)
}
set_nonclient_dev_color(gs_currentdevicecolor_inline(pgs), 1);
pgs->log_op = lop_default;
- /*
- * In the unlikely event that overprint mode is in effect,
- * update the overprint information.
- */
- if (pgs->effective_overprint_mode == 1)
- (void)gs_do_set_overprint(pgs);
+
+ /* If we changed the overprint condition, restore */
+ if (overprint)
+ gs_setoverprint(pgs, true);
return 0;
}
diff --git a/base/gscsepr.c b/base/gscsepr.c
index d9c98f161..04df66fba 100644
--- a/base/gscsepr.c
+++ b/base/gscsepr.c
@@ -149,28 +149,18 @@ static int
gx_set_overprint_Separation(const gs_color_space * pcs, gs_gstate * pgs)
{
gs_devicen_color_map * pcmap = &pgs->color_component_map;
- gx_device *dev = pgs->device;
- cmm_dev_profile_t *dev_profile;
- dev_proc(dev, get_profile)(dev, &(dev_profile));
if (pcmap->use_alt_cspace)
- if (dev_profile->sim_overprint &&
- dev->color_info.polarity == GX_CINFO_POLARITY_SUBTRACTIVE &&
- !gx_device_must_halftone(dev))
- return gx_simulated_set_overprint(pcs->base_space, pgs);
- else
- return gx_spot_colors_set_overprint(pcs->base_space, pgs);
+ return gx_spot_colors_set_overprint(pcs->base_space, pgs);
else {
gs_overprint_params_t params;
/* We should not have to blend if we don't need the alternate tint transform */
- params.blendspot = false;
params.retain_any_comps = pgs->overprint &&
pcs->params.separation.sep_type != SEP_ALL;
if (params.retain_any_comps) {
params.retain_spot_comps = false;
params.drawn_comps = 0;
- params.k_value = 0;
if (pcs->params.separation.sep_type != SEP_NONE) {
int mcomp = pcmap->color_map[0];
@@ -178,6 +168,7 @@ gx_set_overprint_Separation(const gs_color_space * pcs, gs_gstate * pgs)
gs_overprint_set_drawn_comp( params.drawn_comps, mcomp);
}
}
+ /* Only DeviceCMYK can use overprint mode */
pgs->effective_overprint_mode = 0;
return gs_gstate_update_overprint(pgs, &params);
}
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);
}
diff --git a/base/gsicc.c b/base/gsicc.c
index 038fa7366..80c6464de 100644
--- a/base/gsicc.c
+++ b/base/gsicc.c
@@ -434,6 +434,14 @@ gx_remap_ICC(const gs_client_color * pcc, const gs_color_space * pcs,
if_debug1m(gs_debug_flag_icc, dev->memory, "%d ", psrc_temp[k]);
}
if_debug0m(gs_debug_flag_icc, dev->memory, "]\n");
+ } else {
+ num_src_comps = pcs->cmm_icc_profile_data->num_comps;
+ if_debug0m(gs_debug_flag_icc, dev->memory, "[icc] Identity mapping\n");
+ if_debug0m(gs_debug_flag_icc, dev->memory, "[icc] [ ");
+ for (k = 0; k < num_src_comps; k++) {
+ if_debug1m(gs_debug_flag_icc, dev->memory, "%d ", psrc[k]);
+ }
+ if_debug0m(gs_debug_flag_icc, dev->memory, "]\n");
}
#endif
/* Release the link */
@@ -652,22 +660,26 @@ gx_set_overprint_ICC(const gs_color_space * pcs, gs_gstate * pgs)
{
gx_device *dev = pgs->device;
gx_device_color_info *pcinfo = (dev == 0 ? 0 : &dev->color_info);
+ bool cs_ok;
+ cmm_dev_profile_t *dev_profile;
+ bool gray_to_k;
- /* check if we require special handling */
- if ( !pgs->overprint ||
- pgs->overprint_mode != 1 ||
- pcinfo == 0 ||
- pcs->cmm_icc_profile_data->data_cs != gsCMYK ||
- pcinfo->opmode == GX_CINFO_OPMODE_NOT ) {
- return gx_spot_colors_set_overprint(pcs, pgs);
- }
+ if (dev == 0 || pcinfo == NULL)
+ return gx_spot_colors_set_overprint(pcs, pgs);
- if (pcinfo->opmode == GX_CINFO_OPMODE_RGB ||
- pcinfo->opmode == GC_CINFO_OPMODE_RGB_SET) {
- return gx_set_overprint_rgb(pcs, pgs);
- } else {
+ dev_proc(dev, get_profile)(dev, &dev_profile);
+ gray_to_k = dev_profile->devicegraytok;
+
+ /* Possibly do CMYK based overprinting if profile is CMYK based or if we
+ are gray source based and doing gray to k mapping
+ (Ghent GWG 3.0 Gray Overprint Patch (030_Gray_K_black_OP_x1a.pdf) */
+ cs_ok = ((pcs->cmm_icc_profile_data->data_cs == gsCMYK) ||
+ (pcs->cmm_icc_profile_data->data_cs == gsGRAY && gray_to_k));
+
+ if (!pgs->overprint || pcinfo->opmode == GX_CINFO_OPMODE_NOT || !cs_ok)
+ return gx_spot_colors_set_overprint(pcs, pgs);
+ else
return gx_set_overprint_cmyk(pcs, pgs);
- }
}
int
diff --git a/base/gsovrc.c b/base/gsovrc.c
index 0594f0526..64c3fc9c8 100644
--- a/base/gsovrc.c
+++ b/base/gsovrc.c
@@ -125,7 +125,6 @@ c_overprint_equal(const gs_composite_t * pct0, const gs_composite_t * pct1)
*/
#define OVERPRINT_ANY_COMPS 1
#define OVERPRINT_SPOT_COMPS 2
-#define OVERPRINT_BLEND 4
/*
* Convert an overprint compositor to string form for use by the command
@@ -141,28 +140,13 @@ c_overprint_write(const gs_composite_t * pct, byte * data, uint * psize, gx_devi
/* encoded the booleans in a single byte */
if (pparams->retain_any_comps) {
flags |= OVERPRINT_ANY_COMPS;
- if (pparams->blendspot)
- flags |= OVERPRINT_BLEND;
if (pparams->retain_spot_comps)
flags |= OVERPRINT_SPOT_COMPS;
/* write out the component bits only if necessary (and possible) */
- if (!pparams->retain_spot_comps || pparams->blendspot) {
+ if (!pparams->retain_spot_comps) {
uint tmp_size = (avail > 0 ? avail - 1 : 0);
- int code = write_color_index(pparams->drawn_comps, data + 1,
+ int code = write_color_index(pparams->drawn_comps, data + 1,
&tmp_size);
- /* It would be nice to do have an If RGB OP case, then write out
- K value, but on the reader side, there is no way to find this
- out so we will always write it out if we are writing the
- drawn_comps */
- if (code == 0) {
- /* Actually writing not getting size */
- int pos = tmp_size + 1;
- memcpy(&(data[pos]), &(pparams->k_value), sizeof(pparams->k_value));
- pos = pos + sizeof(pparams->k_value);
- memcpy(&(data[pos]), &(pparams->blendspot), sizeof(pparams->blendspot));
- }
- used += sizeof(pparams->k_value);
- used += sizeof(pparams->blendspot);
if (code < 0 && code != gs_error_rangecheck)
return code;
used += tmp_size;
@@ -201,19 +185,13 @@ c_overprint_read(
params.retain_spot_comps = (flags & OVERPRINT_SPOT_COMPS) != 0;
params.idle = 0;
params.drawn_comps = 0;
- params.blendspot = (flags & OVERPRINT_BLEND) != 0;
- params.k_value = 0;
/* check if the drawn_comps array is present */
- if (params.retain_any_comps && (!params.retain_spot_comps || params.blendspot)) {
+ if (params.retain_any_comps && (!params.retain_spot_comps)) {
code = read_color_index(&params.drawn_comps, data + 1, size - 1);
if (code < 0)
return code;
nbytes += code;
- memcpy(&(params.k_value), &(data[nbytes]), sizeof(params.k_value));
- nbytes += sizeof(params.k_value);
- memcpy(&(params.blendspot), &(data[nbytes]), sizeof(params.blendspot));
- nbytes += sizeof(params.blendspot);
}
code = gs_create_overprint(ppct, &params, mem);
return code < 0 ? code : nbytes;
@@ -314,14 +292,6 @@ typedef struct overprint_device_s {
* for the devn color values since we may need more than 8 components
*/
gx_color_index drawn_comps;
-
- /* This is used to compensate for the use of black overprint for when
- we are simulating CMYK overprinting with an RGB output device */
- ushort k_value;
-
- /* Used to indicate that the CMYK value should be blended to achieve
- overprint simulation */
- bool blendspot;
/*
* The mask of gx_color_index bits to be retained during a drawing
@@ -344,7 +314,7 @@ typedef struct overprint_device_s {
* is little-endian.
*/
gx_color_index retain_mask;
-
+
bool copy_alpha_hl;
/* We hold 3 sets of device procedures here. These are initialised from
@@ -752,7 +722,6 @@ update_overprint_params(
const gs_overprint_params_t * pparams )
{
uchar ncomps = opdev->color_info.num_components;
- bool degenerate_k = true; /* Used only for RGB simulation case */
/* check if overprint is to be turned off */
if (!pparams->retain_any_comps || pparams->idle) {
@@ -775,10 +744,8 @@ update_overprint_params(
sizeof(opdev->generic_overprint_procs) );
/* see if we need to determine the spot color components */
- opdev->blendspot = pparams->blendspot;
if (!pparams->retain_spot_comps) {
opdev->drawn_comps = pparams->drawn_comps;
- opdev->k_value = pparams->k_value;
} else {
gx_device * dev = (gx_device *)opdev;
const gx_cm_color_map_procs * pprocs;
@@ -815,18 +782,6 @@ update_overprint_params(
opdev->drawn_comps = drawn_comps;
}
- /* check for degenerate case */
- if (ncomps == 3 && pparams->k_value != 0) {
- degenerate_k = false;
- }
- if (degenerate_k && !(opdev->blendspot) &&
- opdev->drawn_comps == ((gx_color_index)1 << ncomps) - 1) {
- memcpy( &opdev->procs,
- &opdev->no_overprint_procs,
- sizeof(opdev->no_overprint_procs) );
- return 0;
- }
-
/* if appropriate, update the retain_mask field */
if (opdev->color_info.separable_and_linear == GX_CINFO_SEP_LIN)
set_retain_mask(opdev);
@@ -937,9 +892,7 @@ overprint_create_compositor(
params.idle = pct->idle;
/* device must already exist, so just update the parameters */
- code = update_overprint_params(
- (overprint_device_t *)dev,
- &params );
+ code = update_overprint_params((overprint_device_t *)dev, &params);
if (code >= 0)
*pcdev = dev;
return code;
@@ -968,12 +921,9 @@ overprint_generic_fill_rectangle(
if (tdev == 0)
return 0;
else
- return gx_overprint_generic_fill_rectangle( tdev, opdev->blendspot,
- opdev->drawn_comps,
- opdev->k_value,
- x, y, width, height,
- color,
- dev->memory );
+ return gx_overprint_generic_fill_rectangle(tdev, opdev->drawn_comps, x,
+ y, width, height, color,
+ dev->memory);
}
static int
@@ -982,9 +932,9 @@ overprint_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
const gx_drawing_color *pdcolor, int depth)
{
/* copy_alpha_hl_color will end up calling copy_planes which for the
- copy alpha case we need to make sure we do in a proper overprint
+ copy alpha case we need to make sure we do in a proper overprint
fashion. Other calls of copy_alpha for example from the pattern
- tiling call are not done with overprint control. So we set an
+ tiling call are not done with overprint control. So we set an
appopriate flag so that we know to handle this properly when we
get to copy_alpha */
@@ -992,7 +942,7 @@ overprint_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
int code;
opdev->copy_alpha_hl = true;
- code = gx_default_copy_alpha_hl_color(dev, data, data_x, raster, id, x, y,
+ code = gx_default_copy_alpha_hl_color(dev, data, data_x, raster, id, x, y,
width, height, pdcolor, depth);
opdev->copy_alpha_hl = false;
return code;
@@ -1000,10 +950,10 @@ overprint_copy_alpha_hl_color(gx_device * dev, const byte * data, int data_x,
/* Currently we really should only be here if the target device is planar
AND it supports devn colors AND is 8 bit. This could use a rewrite to
- make if more efficient but I had to get something in place that would
+ make if more efficient but I had to get something in place that would
work */
static int
-overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster_in,
+overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster_in,
gx_bitmap_id id, int x, int y, int w, int h, int plane_height)
{
overprint_device_t * opdev = (overprint_device_t *)dev;
@@ -1049,29 +999,29 @@ overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster
| GB_ALIGN_STANDARD
| GB_OFFSET_0
| GB_RASTER_STANDARD
- | GB_SELECT_PLANES;
+ | GB_SELECT_PLANES;
- gb_params.x_offset = 0;
+ gb_params.x_offset = 0;
gb_params.raster = raster;
gb_rect.p.x = x;
gb_rect.q.x = x + w;
-
+
/* step through the height */
row = 0;
while (h-- > 0 && code >= 0) {
comps = opdev->drawn_comps;
gb_rect.p.y = y++;
gb_rect.q.y = y;
- offset = row * raster_in + data_x;
+ offset = row * raster_in + data_x;
row++;
- curr_data = (byte *) data + offset; /* start us at the start of row */
+ curr_data = (byte *) data + offset; /* start us at the start of row */
/* And now through each plane */
for (k = 0; k < tdev->color_info.num_components; k++) {
/* First set the params to zero for all planes except the one we want */
- for (j = 0; j < tdev->color_info.num_components; j++)
+ for (j = 0; j < tdev->color_info.num_components; j++)
gb_params.data[j] = 0;
gb_params.data[k] = gb_buff + k * raster;
- code = dev_proc(tdev, get_bits_rectangle) (tdev, &gb_rect,
+ code = dev_proc(tdev, get_bits_rectangle) (tdev, &gb_rect,
&gb_params, 0);
if (code < 0) {
gs_free_object(mem, gb_buff, "overprint_copy_planes" );
@@ -1087,7 +1037,7 @@ overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster
curr_data += plane_height * raster_in;
comps >>= 1;
}
- code = dev_proc(tdev, copy_planes)(tdev, gb_buff, 0, raster,
+ code = dev_proc(tdev, copy_planes)(tdev, gb_buff, 0, raster,
gs_no_bitmap_id, x, y - 1, w, 1, 1);
}
gs_free_object(mem, gb_buff, "overprint_copy_planes" );
@@ -1096,16 +1046,16 @@ overprint_copy_planes(gx_device * dev, const byte * data, int data_x, int raster
/* This is not a case where copy planes should be doing overprinting.
For example, if we came here via the pattern tiling code, so just
pass this along to the target */
- return (*dev_proc(tdev, copy_planes)) (tdev, data, data_x, raster_in, id,
+ return (*dev_proc(tdev, copy_planes)) (tdev, data, data_x, raster_in, id,
x, y, w, h, plane_height);
}
}
/* Currently we really should only be here if the target device is planar
AND it supports devn colors AND is 8 bit. */
-static int
+static int
overprint_fill_rectangle_hl_color(gx_device *dev,
- const gs_fixed_rect *rect, const gs_gstate *pgs,
+ const gs_fixed_rect *rect, const gs_gstate *pgs,
const gx_drawing_color *pdcolor, const gx_clip_path *pcpath)
{
overprint_device_t * opdev = (overprint_device_t *)dev;
@@ -1155,7 +1105,7 @@ overprint_fill_rectangle_hl_color(gx_device *dev,
| GB_ALIGN_STANDARD
| GB_OFFSET_0
| GB_RASTER_STANDARD
- | GB_SELECT_PLANES;
+ | GB_SELECT_PLANES;
gb_params.x_offset = 0; /* for consistency */
gb_params.raster = raster;
@@ -1170,28 +1120,28 @@ overprint_fill_rectangle_hl_color(gx_device *dev,
/* And now through each plane */
for (k = 0; k < tdev->color_info.num_components; k++) {
/* First set the params to zero for all planes except the one we want */
- for (j = 0; j < tdev->color_info.num_components; j++)
+ for (j = 0; j < tdev->color_info.num_components; j++)
gb_params.data[j] = 0;
gb_params.data[k] = gb_buff + k * raster;
- code = dev_proc(tdev, get_bits_rectangle) (tdev, &gb_rect,
+ code = dev_proc(tdev, get_bits_rectangle) (tdev, &gb_rect,
&gb_params, 0);
if (code < 0) {
- gs_free_object(mem, gb_buff,
+ gs_free_object(mem, gb_buff,
"overprint_fill_rectangle_hl_color" );
return code;
}
/* Skip the plane if this component is not to be drawn. We have
to do a get bits for each plane due to the fact that we have
- to do a copy_planes at the end. If we had a copy_plane
+ to do a copy_planes at the end. If we had a copy_plane
operation we would just get the ones needed and set those. */
if ((comps & 0x01) == 1) {
/* Not sure if a loop or a memset is better here */
- memset(gb_params.data[k],
+ memset(gb_params.data[k],
((pdcolor->colors.devn.values[k]) >> shift & mask), w);
}
comps >>= 1;
}
- code = dev_proc(tdev, copy_planes)(tdev, gb_buff, 0, raster,
+ code = dev_proc(tdev, copy_planes)(tdev, gb_buff, 0, raster,
gs_no_bitmap_id, x, y - 1, w, 1, 1);
}
gs_free_object(mem, gb_buff,
@@ -1240,19 +1190,14 @@ overprint_sep_fill_rectangle(
* we need only check that depth is a power of 2 and
* depth < 8 * sizeof(mono_fill_chunk).
*/
- if ( depth <= 8 * sizeof(mono_fill_chunk) &&
- (depth & (depth - 1)) == 0 && !(opdev->blendspot))
- return gx_overprint_sep_fill_rectangle_1( tdev,
- opdev->retain_mask,
+ if ( depth <= 8 * sizeof(mono_fill_chunk) && (depth & (depth - 1)) == 0)
+ return gx_overprint_sep_fill_rectangle_1(tdev, opdev->retain_mask,
x, y, width, height,
- color,
- dev->memory );
+ color, dev->memory);
else
- return gx_overprint_sep_fill_rectangle_2( tdev, opdev->blendspot,
- opdev->retain_mask,
+ return gx_overprint_sep_fill_rectangle_2(tdev,opdev->retain_mask,
x, y, width, height,
- color,
- dev->memory );
+ color, dev->memory);
}
}
diff --git a/base/gsovrc.h b/base/gsovrc.h
index 8fbb05e2e..5f6cdb07c 100644
--- a/base/gsovrc.h
+++ b/base/gsovrc.h
@@ -276,19 +276,6 @@ struct gs_overprint_params_s {
* it is to be left unaffected.
*/
gx_color_index drawn_comps;
-
- /* A representation of the K value that is used for simulating CMYK
- overprinting out to an RGB device. While CMY map readily to RGB using
- the simple 255-X color process, we have to know what the K value
- was if we are overprinting with K so that we can properly reduce
- the RGB values with the addition of K. We will use 8 bits for this.
- */
- unsigned short k_value;
-
- /* This is used when we want to simulate the overprint of spot colors
- by blending the equivalent CMYK colorant with with what was already
- drawn */
- bool blendspot;
};
/*
diff --git a/base/gstrans.h b/base/gstrans.h
index d06cc5234..62fb74697 100644
--- a/base/gstrans.h
+++ b/base/gstrans.h
@@ -65,7 +65,6 @@ typedef enum {
#define PDF14_SET_OPACITY_ALPHA (1 << 3)
#define PDF14_SET_OVERPRINT (1 << 4)
#define PDF14_SET_OVERPRINT_MODE (1 << 5)
-#define PDF14_SET_OVERPRINT_BLEND (1 << 6)
#ifndef gs_function_DEFINED
typedef struct gs_function_s gs_function_t;
@@ -114,7 +113,6 @@ struct gs_pdf14trans_params_s {
bool replacing;
bool overprint;
bool overprint_mode;
- bool blendspot;
bool idle; /* For clist reader.*/
uint mask_id; /* For clist reader.*/
int group_color_numcomps;
diff --git a/base/gxblend.h b/base/gxblend.h
index 5fcfea56b..f2b996aeb 100644
--- a/base/gxblend.h
+++ b/base/gxblend.h
@@ -377,8 +377,8 @@ int pdf14_preserve_backdrop_cm(pdf14_buf *buf, cmm_profile_t *group_profile,
void pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
int x0, int x1, int y0, int y1, int n_chan, bool additive,
const pdf14_nonseparable_blending_procs_t * pblend_procs,
- bool overprint, gx_color_index drawn_comps, bool blendspot,
- gs_memory_t *memory, gx_device *dev);
+ bool overprint, gx_color_index drawn_comps, gs_memory_t *memory,
+ gx_device *dev);
gx_color_index pdf14_encode_color(gx_device *dev, const gx_color_value colors[]);
gx_color_index pdf14_encode_color_tag(gx_device *dev, const gx_color_value colors[]);
diff --git a/base/gxblend1.c b/base/gxblend1.c
index ace5684c7..0c68c3713 100644
--- a/base/gxblend1.c
+++ b/base/gxblend1.c
@@ -296,8 +296,8 @@ void
pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf,
int x0, int x1, int y0, int y1, int n_chan, bool additive,
const pdf14_nonseparable_blending_procs_t * pblend_procs,
- bool overprint, gx_color_index drawn_comps, bool blendspot,
- gs_memory_t *memory, gx_device *dev)
+ bool overprint, gx_color_index drawn_comps, gs_memory_t *memory,
+ gx_device *dev)
{
int num_spots = tos->num_spots;
byte alpha = tos->alpha;
diff --git a/base/gxcmap.c b/base/gxcmap.c
index 73e9c3fda..7c135e2a5 100644
--- a/base/gxcmap.c
+++ b/base/gxcmap.c
@@ -562,7 +562,7 @@ gx_remap_color(gs_gstate * pgs)
(gs_gstate *) pgs, pgs->device,
gs_color_select_texture);
/* if overprint mode is in effect, update the overprint information */
- if (code >= 0 && pgs->effective_overprint_mode == 1)
+ if (code >= 0 && pgs->overprint)
code = gs_do_set_overprint(pgs);
return code;
}
@@ -660,7 +660,7 @@ gs_color_select_t select)
order already. If we have specified the colorants with
-sICCOutputColors (i.e. if you are using an NCLR output profile) then
we should be good. If not or if instead one used SeparationColorNames and
- SeparationOrder to set up the device, then we need to make a copy
+ SeparationOrder to set up the device, then we need to make a copy
of the gs_gstate and make sure that we set color_component_map is
properly set up for the gx_remap_concrete_devicen proc. */
for (k = 0; k < num_des_comps; k++)
@@ -690,7 +690,7 @@ gs_color_select_t select)
} else {
gs_gstate temp_state = *((const gs_gstate *)pgs);
- /* No NCLR profile with spot names. So set up the
+ /* No NCLR profile with spot names. So set up the
color_component_map in the gs_gstate. Again, note that
gsicc_transform_named_color must have set ALL the device
colors */
@@ -785,7 +785,7 @@ gx_remap_DeviceGray(const gs_client_color * pc, const gs_color_space * pcs,
(*pcs_notconst->type->remap_color)(gs_currentcolor_inline(pgs),
pcs_notconst,
gs_currentdevicecolor_inline(pgs),
- pgs, pgs->device,
+ pgs, pgs->device,
gs_color_select_texture);
return code;
}
diff --git a/base/gxcspace.h b/base/gxcspace.h
index 7e317d188..c3e0188bc 100644
--- a/base/gxcspace.h
+++ b/base/gxcspace.h
@@ -247,7 +247,6 @@ cs_proc_remap_color(gx_default_remap_color);
cs_proc_remap_color(gx_remap_named_color);
cs_proc_install_cspace(gx_no_install_cspace);
cs_proc_set_overprint(gx_spot_colors_set_overprint);
-cs_proc_set_overprint(gx_simulated_set_overprint);
cs_proc_adjust_color_count(gx_no_adjust_color_count);
cs_proc_serialize(gx_serialize_cspace_type);
cs_proc_is_linear(gx_cspace_no_linear);
@@ -275,13 +274,10 @@ gs_color_space *
gs_cspace_alloc(gs_memory_t *mem, const gs_color_space_type *pcstype);
/* Determine if the current color model is a "DeviceCMYK" color model, and */
-/* if so what are its process color components. Also the same for the RGB */
-/* device that simulates CMYK overprinting */
+/* if so what are its process color components. */
gx_color_index check_cmyk_color_model_comps(gx_device * dev);
-gx_color_index check_rgb_color_model_comps(gx_device * dev);
/* Shared code with ICC overprint */
int gx_set_overprint_cmyk(const gs_color_space * pcs, gs_gstate * pgs);
-int gx_set_overprint_rgb(const gs_color_space * pcs, gs_gstate * pgs);
#endif /* gxcspace_INCLUDED */
diff --git a/base/gxdevcli.h b/base/gxdevcli.h
index 4d4d91629..8755ae184 100644
--- a/base/gxdevcli.h
+++ b/base/gxdevcli.h
@@ -255,16 +255,11 @@ typedef enum {
* information is required, hence the use of an enumeration with an
* "unknown" setting.
*
- * GX_CINFO_OPMODE_RGB is an odd case where by the device is RGB based
- * but we attempt to simulate CMY overprinting. GC_CINFO_OPMODE_RGB_SET
- * is the value after we verify the color model and the colorant positions
*/
typedef enum {
GX_CINFO_OPMODE_UNKNOWN = -1,
GX_CINFO_OPMODE_NOT = 0,
- GX_CINFO_OPMODE = 1,
- GX_CINFO_OPMODE_RGB,
- GC_CINFO_OPMODE_RGB_SET
+ GX_CINFO_OPMODE = 1
} gx_cm_opmode_t;
/* component index value used to indicate no color component. */
diff --git a/base/gxoprect.c b/base/gxoprect.c
index 822851aa1..78a28b6cf 100644
--- a/base/gxoprect.c
+++ b/base/gxoprect.c
@@ -187,9 +187,7 @@ pack_scanline_ge8(
int
gx_overprint_generic_fill_rectangle(
gx_device * tdev,
- bool blendspot,
gx_color_index drawn_comps,
- ushort k_value,
int x,
int y,
int w,
@@ -322,21 +320,9 @@ gx_overprint_generic_fill_rectangle(
if ((code = dev_proc(tdev, decode_color)(tdev, *cp, dest_cvals)) < 0)
break;
- if (k_value > 0) {
- /* Have to run through all 3 components */
- for (j = 0, comps = drawn_comps; j < 3; j++, comps >>= 1) {
+ for (j = 0, comps = drawn_comps; comps != 0; ++j, comps >>= 1) {
if ((comps & 0x1) != 0)
dest_cvals[j] = src_cvals[j];
- else {
- int temp = (dest_cvals[j] * (256 - k_value));
- dest_cvals[j] = temp >> 8;
- }
- }
- } else {
- for (j = 0, comps = drawn_comps; comps != 0; ++j, comps >>= 1) {
- if ((comps & 0x1) != 0)
- dest_cvals[j] = src_cvals[j];
- }
}
*cp = dev_proc(tdev, encode_color)(tdev, dest_cvals);
}
@@ -539,7 +525,6 @@ gx_overprint_sep_fill_rectangle_1(
int
gx_overprint_sep_fill_rectangle_2(
gx_device * tdev,
- bool blendspot,
gx_color_index retain_mask, /* already swapped */
int x,
int y,
diff --git a/base/gxoprect.h b/base/gxoprect.h
index 88834ba61..d917b82c2 100644
--- a/base/gxoprect.h
+++ b/base/gxoprect.h
@@ -27,9 +27,7 @@
*/
extern int gx_overprint_generic_fill_rectangle(
gx_device * tdev,
- bool blendspot,
gx_color_index drawn_comps,
- ushort k_value,
int x,
int y,
int w,
@@ -64,7 +62,6 @@ extern int gx_overprint_sep_fill_rectangle_1(
extern int gx_overprint_sep_fill_rectangle_2(
gx_device * tdev,
- bool blendspot,
gx_color_index retain_mask, /* already swapped */
int x,
int y,