summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-31 14:53:38 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-31 15:41:37 +0100
commit3f9d9ffbb30220b9592072a6dde5e4d440ab2e15 (patch)
tree0ea07cb0fddc027ecadbdc688d6eda00f7d86793 /include
parent009937106775864f68a18c061959159a0893e35e (diff)
downloadmupdf-3f9d9ffbb30220b9592072a6dde5e4d440ab2e15.tar.xz
Update test device with passthrough option.
Update the test device so it can be used 'wrapping' another device. In particular, it can be used to wrap the display list device so that we can evaluate 'color or not' while building the display list rather than having to rerun the display list afterwards. Also, give improved control over whether we test every pixel of images/shadings.
Diffstat (limited to 'include')
-rw-r--r--include/mupdf/fitz/device.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h
index caa01cb2..d0a8f0ed 100644
--- a/include/mupdf/fitz/device.h
+++ b/include/mupdf/fitz/device.h
@@ -296,11 +296,39 @@ fz_device *fz_new_bbox_device(fz_context *ctx, fz_rect *rectp);
Currently only tests for the presence of non-grayscale colors.
+ is_color: Possible values returned:
+ 0: Definitely greyscale
+ 1: Probably color (all colors were grey, but there
+ were images or shadings in a non grey colorspace).
+ 2: Definitely color
+
threshold: The difference from grayscale that will be tolerated.
Typical values to use are either 0 (be exact) and 0.02 (allow an
imperceptible amount of slop).
+
+ options: A set of bitfield options, from the FZ_TEST_OPT set.
+
+ passthrough: A device to pass all calls through to, or NULL.
+ If set, then the test device can both test and pass through to
+ an underlying device (like, say, the display list device). This
+ means that a display list can be created and at the end we'll
+ know if it's color or not.
+
+ In the absence of a passthrough device, the device will throw
+ an exception to stop page interpretation when color is found.
*/
-fz_device *fz_new_test_device(fz_context *ctx, int *is_color, float threshold);
+fz_device *fz_new_test_device(fz_context *ctx, int *is_color, float threshold, int options, fz_device *passthrough);
+
+enum
+{
+ /* If set, test every pixel of images exhaustively.
+ * If clear, just look at colorspaces for images. */
+ FZ_TEST_OPT_IMAGES = 1,
+
+ /* If set, test every pixel of shadings. */
+ /* If clear, just look at colorspaces for shadings. */
+ FZ_TEST_OPT_SHADINGS = 2
+};
/*
fz_new_draw_device: Create a device to draw on a pixmap.