diff options
author | Robin Watts <robin.watts@artifex.com> | 2017-09-21 14:10:33 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2017-10-24 15:16:36 +0100 |
commit | abd4c0da5d50cc5b81e430dea3eaa01502370dad (patch) | |
tree | 86df6381b21acc05eba42c2b884068ad96e45110 /source/tools | |
parent | a1e696d27e0927855dd2e0d505afd571b0f37ed7 (diff) | |
download | mupdf-abd4c0da5d50cc5b81e430dea3eaa01502370dad.tar.xz |
Improved overprint (simulation) control.
First, we add an fz_page_overprint function to detect if a
page uses overprint. Only PDF implements this currently (other
formats all return false). PDF looks for '/OP true' in any
ExtGState entry.
We make Mutool check this. If it finds it, and spot rendering
is not completely disabled, then it ensures that the separation
object passed to the pixmap into which we draw is non NULL. This
causes the draw device to do overprint simulation.
We ensure that mutool draw defaults to having the spot rendering
mode default to simulation in builds that support it.
Finally, we ensure that if an output intent is set by the document,
and spot rendering is not completely disabled, then we ensure the
seps object is non NULL so that we render to a group in the
specified output intent, and THEN convert down to the required
colorspace for the output.
This should make us match acrobats behaviour.
Diffstat (limited to 'source/tools')
-rw-r--r-- | source/tools/mudraw.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c index d3cef7a2..f7b87626 100644 --- a/source/tools/mudraw.c +++ b/source/tools/mudraw.c @@ -256,7 +256,12 @@ static int lowmemory = 0; static int errored = 0; static fz_colorspace *colorspace; +static fz_colorspace *oi = NULL; +#ifdef FZ_ENABLE_SPOT_RENDERING +static int spots = SPOTS_OVERPRINT_SIM; +#else static int spots = SPOTS_NONE; +#endif static int alpha; static char *filename; static int files = 0; @@ -352,12 +357,14 @@ static void usage(void) "\t-P\tparallel interpretation/rendering (disabled in this non-threading build)\n" #endif "\t-N\tdisable ICC workflow (\"N\"o color management)\n" - "\t-O -\tControl spot rendering\n" + "\t-O -\tControl spot/overprint rendering\n" "\t\t 0 = No spot rendering\n" #ifdef FZ_ENABLE_SPOT_RENDERING - "\t\t 1 = Overprint simulation\n" + "\t\t 0 = No spot rendering\n" + "\t\t 1 = Overprint simulation (default)\n" "\t\t 2 = Full spot rendering\n" #else + "\t\t 0 = No spot rendering (default)\n" "\t\t 1 = Overprint simulation (Disabled in this build)\n" "\t\t 2 = Full spot rendering (Disabled in this build)\n" #endif @@ -1027,7 +1034,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) page = fz_load_page(ctx, doc, pagenum - 1); - if (spots) + if (spots != SPOTS_NONE) { fz_try(ctx) { @@ -1042,11 +1049,18 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) for (i = 0; i < n; i++) fz_set_separation_behavior(ctx, seps, i, FZ_SEPARATION_COMPOSITE); } - else + else if (fz_page_uses_overprint(ctx, page)) + { + /* This page uses overprint, so we need an empty + * sep object to force the overprint simulation on. */ + seps = fz_new_separations(ctx, 0); + } + else if (oi && fz_colorspace_n(ctx, oi) != fz_colorspace_n(ctx, colorspace)) { - /* If we are doing spot rendering (or overprint simulation) - * then we need (at least) an empty sep object to force the - * overprint simulation in the draw device. */ + /* We have an output intent, and it's incompatible + * with the colorspace our device needs. Force the + * overprint simulation on, because this ensures that + * we 'simulate' the output intent too. */ seps = fz_new_separations(ctx, 0); } } @@ -1446,7 +1460,6 @@ int mudraw_main(int argc, char **argv) trace_info info = { 0, 0, 0 }; fz_alloc_context alloc_ctx = { &info, trace_malloc, trace_realloc, trace_free }; fz_locks_context *locks = NULL; - fz_colorspace *oi = NULL; fz_var(doc); |