summaryrefslogtreecommitdiff
path: root/source/tools/mudraw.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-10-16 13:44:52 +0100
committerRobin Watts <robin.watts@artifex.com>2017-10-24 15:16:36 +0100
commitc413f4db6a54846ae85393a87fa1b53b93a966ee (patch)
tree3a06363e8f0570cc139e8cf486f2d9b00c0c52cd /source/tools/mudraw.c
parentc7c407b57a6e1aa5b1a11034ec7cb308cf4ad3c4 (diff)
downloadmupdf-c413f4db6a54846ae85393a87fa1b53b93a966ee.tar.xz
Add support for use of proofing profile.
This is a first cut to get us to demo-ability. There will likely be a few changes as we do a bit more testing with different scenarios with Gray, RGB, CMYK combos of destination, proof and output intent ICC profiles.
Diffstat (limited to 'source/tools/mudraw.c')
-rw-r--r--source/tools/mudraw.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 8f3547b7..6382e95c 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -246,6 +246,8 @@ static int alphabits_text = 8;
static int alphabits_graphics = 8;
static int out_cs = CS_UNSET;
+static const char *proof_filename = NULL;
+fz_colorspace *proof_cs = NULL;
static const char *icc_filename = NULL;
static float gamma_value = 1;
static int invert = 0;
@@ -333,7 +335,8 @@ static void usage(void)
"\t-U -\tfile name of user stylesheet for EPUB layout\n"
"\t-X\tdisable document styles for EPUB layout\n"
"\n"
- "\t-c -\tcolorspace (mono, gray, grayalpha, rgb, rgba, cmyk, cmykalpha)\n"
+ "\t-c -\tcolorspace (mono, gray, grayalpha, rgb, rgba, cmyk, cmykalpha, filename of ICC profile)\n"
+ "\t-e -\tproof icc profile (filename of ICC profile)\n"
"\t-G -\tapply gamma correction\n"
"\t-I\tinvert colors\n"
"\n"
@@ -462,7 +465,7 @@ static void drawband(fz_context *ctx, fz_page *page, fz_display_list *list, cons
else
fz_clear_pixmap_with_value(ctx, pix, 255);
- dev = fz_new_draw_device(ctx, NULL, pix);
+ dev = fz_new_draw_device_with_proof(ctx, NULL, pix, proof_cs);
if (lowmemory)
fz_enable_device_hints(ctx, dev, FZ_NO_CACHE);
if (alphabits_graphics == 0)
@@ -1440,7 +1443,7 @@ int mudraw_main(int argc, char **argv)
fz_var(doc);
- while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:c:G:Is:A:DiW:H:S:T:U:XLvPl:y:NO:")) != -1)
+ while ((c = fz_getopt(argc, argv, "p:o:F:R:r:w:h:fB:c:e:G:Is:A:DiW:H:S:T:U:XLvPl:y:NO:")) != -1)
{
switch (c)
{
@@ -1459,6 +1462,7 @@ int mudraw_main(int argc, char **argv)
case 'B': band_height = atoi(fz_optarg); break;
case 'c': out_cs = parse_colorspace(fz_optarg); break;
+ case 'e': proof_filename = fz_optarg; break;
case 'G': gamma_value = fz_atof(fz_optarg); break;
case 'I': invert++; break;
@@ -1561,6 +1565,9 @@ int mudraw_main(int argc, char **argv)
exit(1);
}
+ if (proof_filename)
+ proof_cs = fz_new_icc_colorspace_from_file(ctx, NULL, proof_filename);
+
fz_set_text_aa_level(ctx, alphabits_text);
fz_set_graphics_aa_level(ctx, alphabits_graphics);
fz_set_graphics_min_line_width(ctx, min_line_width);
@@ -1841,10 +1848,16 @@ int mudraw_main(int argc, char **argv)
oi = fz_document_output_intent(ctx, doc);
if (oi)
{
- if (fz_colorspace_n(ctx, oi) == fz_colorspace_n(ctx, colorspace))
+ /* See if we had explicitly set a profile to render */
+ if (out_cs != CS_ICC)
{
- fz_drop_colorspace(ctx, colorspace);
- colorspace = fz_keep_colorspace(ctx, oi);
+ /* In this case, we want to render to the output intent
+ * color space if the number of channels is the same */
+ if (fz_colorspace_n(ctx, oi) == fz_colorspace_n(ctx, colorspace))
+ {
+ fz_drop_colorspace(ctx, colorspace);
+ colorspace = fz_keep_colorspace(ctx, oi);
+ }
}
}
@@ -1980,6 +1993,7 @@ int mudraw_main(int argc, char **argv)
#endif /* DISABLE_MUTHREADS */
fz_drop_colorspace(ctx, colorspace);
+ fz_drop_colorspace(ctx, proof_cs);
fz_drop_context(ctx);
#ifndef DISABLE_MUTHREADS