summaryrefslogtreecommitdiff
path: root/psi/ztrans.c
diff options
context:
space:
mode:
authorMichael Vrhel <michael.vrhel@artifex.com>2020-11-14 18:26:21 -0800
committerMichael Vrhel <michael.vrhel@artifex.com>2021-02-05 22:27:23 -0800
commit813b5f48e845d528d3070d9168aa51035a614c1c (patch)
tree538e0f4d2edbeab31c8b1ea982de44d617868128 /psi/ztrans.c
parent0bd6877f480a84657696a80adc13f9c5485dd996 (diff)
downloadghostpdl-813b5f48e845d528d3070d9168aa51035a614c1c.tar.gz
Bug 695925: Implement overprint simulation for all devices
This adds the capability to simulate overprint including that of spot colors for all devices including gray and RGB devices. This is achieved by having the PDF interpreter look if overprint is present, the seting of -dOverprint (/simulate /enable /disable), if the page has transparency, and if the page has spot colors. Depending upon the color model of the device, and if transparency is present, a special push of the pdf14 device may occur. The pdf14 device buffer collects the data in a CMYK or CMYK+spots buffer and the put_image method in the pdf14 device will map the buffer to the target device color space. The code was tested with devices that support and do not support spot colors, those that support and do not support alpha channels, tag based devices, gray, RGB, and CMYK devices. A special test file to check multiple cases was added to the regression suite. By default -dOverprint is set to /enable, which should result in the existing behavior where by RGB and Gray devices do no show overprint or spot colors and CMYK devices will handle CMYK overprinting and separation devices will show spots and overprint of all colorants. With -dOverprint set to /disable no device will show overprinting. With -dOverprint set to /simulate all devices will show overprint and spot colors. Ray Johnston did the work in the interpreter as well as the device parameter default setup. I did the pdf14 device changes and testing. Changes in a variety of locations were required due to the fact that new combinations were encountered, for example we had cases where devn colors were being used with a device that supports tags (bitrgbtags device and pdf14 compositor setup for CMYK+spots). One file: tests_private/xps/xpsfts-a4/fts_34xx.xps.pdf ppmraw 72 now produces an error. This file should have been throwing an error all along but was being quietly swallowed. Acrobat will not open the created pdf file and throws and error. I will open a bug for the issue as it is a problem with the XPS interpreter.
Diffstat (limited to 'psi/ztrans.c')
-rw-r--r--psi/ztrans.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/psi/ztrans.c b/psi/ztrans.c
index 4a26bdd49..74808420e 100644
--- a/psi/ztrans.c
+++ b/psi/ztrans.c
@@ -26,6 +26,7 @@
#include "gxiparam.h" /* for image enumerator */
#include "gxcspace.h"
#include "idict.h"
+#include "idstack.h"
#include "idparam.h"
#include "ifunc.h"
#include "igstate.h"
@@ -471,10 +472,18 @@ static int
zpushpdf14devicefilter(i_ctx_t *i_ctx_p)
{
int code;
+ int depth;
+ int spot_color_count = -1; /* default is 'unknown' spot color count */
os_ptr op = osp;
gx_device *cdev = gs_currentdevice_inline(igs);
+ dict_stack_t *dstack = &(i_ctx_p->dict_stack);
+ ref_stack_t *rdstack = &dstack->stack;
+ const ref *puserdict = ref_stack_index(rdstack, ref_stack_count(rdstack) - 1 -
+ dstack->userdict_index);
check_type(*op, t_integer);
+ depth = (int)op->value.intval;
+
if (dev_proc(cdev, dev_spec_op)(cdev, gxdso_is_pdf14_device, NULL, 0) > 0)
return 0; /* ignore push_device if already is pdf14 device */
@@ -482,7 +491,8 @@ zpushpdf14devicefilter(i_ctx_t *i_ctx_p)
/* sure that the device knows that we are using the pdf14 */
/* transparency. Note this will close and re-open the device */
/* and erase the page. This should not occur with PDF files. */
- if (cdev->page_uses_transparency == 0) {
+ /* We don't do this if this is a push for the overprint_sim mode */
+ if (depth >= 0 && cdev->page_uses_transparency == 0) {
gs_c_param_list list;
bool bool_true = 1;
@@ -504,7 +514,12 @@ zpushpdf14devicefilter(i_ctx_t *i_ctx_p)
if ((code = gs_erasepage(igs)) < 0)
return code;
}
- code = gs_push_pdf14trans_device(igs, false, true);
+ /* Get the PageSpotColors value from the userdict, if it is defined */
+ code = dict_int_param(puserdict, "PageSpotColors", -1, max_int, -1, &spot_color_count);
+ if (code < 0)
+ return code;
+ /* and finally actually push the compositor device */
+ code = gs_push_pdf14trans_device(igs, false, true, depth, spot_color_count);
if (code < 0)
return code;
pop(1);