From 7662af082b44f8164d1adadc5688f30d888e6a63 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 22 Aug 2014 15:35:13 +0200 Subject: Revise test-device; thresholding and exhaustive checking. The original version of the test-device could characterise pages as being grayscale/color purely based on the colorspaces used. This could easily be upset by grayscale images or shadings that happened to be specified in non-grayscale colorspaces however. We now look at the actual shading and image color values, and use a threshold value to allow for some measure of rounding errors in color values that are in practice grayscale. --- include/mupdf/fitz/device.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mupdf/fitz/device.h b/include/mupdf/fitz/device.h index 18dc4881..ef27cd5d 100644 --- a/include/mupdf/fitz/device.h +++ b/include/mupdf/fitz/device.h @@ -290,8 +290,12 @@ fz_device *fz_new_bbox_device(fz_context *ctx, fz_rect *rectp); fz_new_test_device: Create a device to test for features. Currently only tests for the presence of non-grayscale colors. + + 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). */ -fz_device *fz_new_test_device(fz_context *ctx, int *iscolor); +fz_device *fz_new_test_device(fz_context *ctx, int *is_color, float threshold); /* fz_new_draw_device: Create a device to draw on a pixmap. -- cgit v1.2.3