/* Set overprint information for a DeviceN color space */ static int gx_set_overprint_DeviceN(const gs_color_space * pcs, gs_state * 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 */ code = check_DeviceN_component_names(pcs, pgs); if (code < 0) return code; 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); } } else { gs_overprint_params_t params; if ((params.retain_any_comps = pgs->overprint)) { int i, ncomps = pcs->params.device_n.num_components; 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]; if (mcomp >= 0) gs_overprint_set_drawn_comp( params.drawn_comps, mcomp); } } pgs->effective_overprint_mode = 0; return gs_state_update_overprint(pgs, ¶ms); } }
/* Install a DeviceN color space. */ static int gx_install_DeviceN(gs_color_space * pcs, gs_state * pgs) { int code; code = check_DeviceN_component_names(pcs, pgs); if (code < 0) return code; /* See if we have an ICC profile that we can associate with this DeviceN color space */ if (pgs->icc_manager->device_n != NULL) { /* An nclr profile is in the manager. Grab one that matches. */ cmm_profile_t *profdata = gsicc_finddevicen(pcs, pgs->icc_manager); if (profdata != NULL) rc_increment(profdata); if (pcs->cmm_icc_profile_data != NULL) rc_decrement(pcs->cmm_icc_profile_data, "gx_install_DeviceN"); pcs->cmm_icc_profile_data = profdata; } /* {csrc} was pgs->color_space->params.device_n.use_alt_cspace */ ((gs_color_space *)pcs)->params.device_n.use_alt_cspace = using_alt_color_space(pgs); if (pcs->params.device_n.use_alt_cspace && pcs->cmm_icc_profile_data == NULL ) { /* No nclr ICC profile */ code = (pcs->base_space->type->install_cspace) (pcs->base_space, pgs); } else if (pcs->params.device_n.use_alt_cspace) { gs_color_space *nclr_pcs; /* Need to install the nclr cspace */ code = gs_cspace_build_ICC(&nclr_pcs, NULL, pgs->memory); nclr_pcs->cmm_icc_profile_data = pcs->cmm_icc_profile_data; rc_increment(pcs->cmm_icc_profile_data); rc_increment_cs(nclr_pcs); /* Suspicious - RJW */ rc_decrement_cs(pcs->base_space, "gx_install_DeviceN"); pcs->base_space = nclr_pcs; } /* * Give the device an opportunity to capture equivalent colors for any * spot colors which might be present in the color space. */ if (code >= 0) { if (dev_proc(pgs->device, update_spot_equivalent_colors)) code = dev_proc(pgs->device, update_spot_equivalent_colors) (pgs->device, pgs); } return code; }
/* Install a DeviceN color space. */ static int gx_install_DeviceN(gs_color_space * pcs, gs_state * pgs) { int code; #if ENABLE_CUSTOM_COLOR_CALLBACK /* * Check if we want to use the callback color processing for this * color space. */ bool use_custom_color_callback = custom_color_callback_install_DeviceN(pcs, pgs); if (use_custom_color_callback) { /* * We are using the callback instead of the alternate tint transform * for this color space. */ pgs->color_component_map.use_alt_cspace = pgs->color_space->params.device_n.use_alt_cspace = false; pgs->color_component_map.cspace_id = pcs->id; return 0; } #endif code = check_DeviceN_component_names(pcs, pgs); if (code < 0) return code; /* {csrc} was pgs->color_space->params.device_n.use_alt_cspace */ ((gs_color_space *)pcs)->params.device_n.use_alt_cspace = using_alt_color_space(pgs); if (pcs->params.device_n.use_alt_cspace) code = (pcs->base_space->type->install_cspace) (pcs->base_space, pgs); /* * Give the device an opportunity to capture equivalent colors for any * spot colors which might be present in the color space. */ if (code >= 0) code = dev_proc(pgs->device, update_spot_equivalent_colors) (pgs->device, pgs); return code; }