diff options
author | fredrossperry <fredrossperry@gmail.com> | 2015-09-08 17:15:40 -0700 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2015-09-29 15:41:31 +0100 |
commit | beb08eb1a1fdda72f4ccea0fdb64367d555026fc (patch) | |
tree | cd2578dcdf2e735cc09d5a7eb2752298c58b3226 | |
parent | 7f0493dbc2825f1889994ae6e0cd5db50c6275ca (diff) | |
download | mupdf-beb08eb1a1fdda72f4ccea0fdb64367d555026fc.tar.xz |
add fz_separation_disabled_on_page() and related functions
-rw-r--r-- | include/mupdf/fitz/document.h | 8 | ||||
-rw-r--r-- | source/fitz/document.c | 8 | ||||
-rw-r--r-- | source/gprf/gprf-doc.c | 10 |
3 files changed, 25 insertions, 1 deletions
diff --git a/include/mupdf/fitz/document.h b/include/mupdf/fitz/document.h index 1d02a9a0..ff399dba 100644 --- a/include/mupdf/fitz/document.h +++ b/include/mupdf/fitz/document.h @@ -52,6 +52,7 @@ typedef fz_rect *(fz_page_bound_annot_fn)(fz_context *ctx, fz_page *page, fz_ann typedef void (fz_page_run_annot_fn)(fz_context *ctx, fz_page *page, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie); typedef void (fz_page_control_separation_fn)(fz_context *ctx, fz_page *page, int separation, int disable); +typedef int (fz_page_separation_disabled_fn)(fz_context *ctx, fz_page *page, int separation); typedef int (fz_page_count_separations_fn)(fz_context *ctx, fz_page *page); typedef const char *(fz_page_get_separation_fn)(fz_context *ctx, fz_page *page, int separation, uint32_t *rgb, uint32_t *cmyk); @@ -68,6 +69,7 @@ struct fz_page_s fz_page_run_annot_fn *run_annot; fz_page_page_presentation_fn *page_presentation; fz_page_control_separation_fn *control_separation; + fz_page_separation_disabled_fn *separation_disabled; fz_page_count_separations_fn *count_separations; fz_page_get_separation_fn *get_separation; }; @@ -382,6 +384,12 @@ int fz_count_separations_on_page(fz_context *ctx, fz_page *page); void fz_control_separation_on_page(fz_context *ctx, fz_page *page, int sep, int disable); /* + Returns whether a given separation on a given page is disabled. This will only + work from a format that supports separations (such as gproof files). + */ +int fz_separation_disabled_on_page (fz_context *ctx, fz_page *, int sep); + +/* Get the name and equivalent RGBA, CMYK colors of a given separation on a given page. This will only work for formats that support gproof files. diff --git a/source/fitz/document.c b/source/fitz/document.c index 9c78187f..1fc4ff87 100644 --- a/source/fitz/document.c +++ b/source/fitz/document.c @@ -425,6 +425,14 @@ void fz_control_separation_on_page(fz_context *ctx, fz_page *page, int sep, int page->control_separation(ctx, page, sep, disable); } +int fz_separation_disabled_on_page (fz_context *ctx, fz_page *page, int sep) +{ + if (ctx == NULL || page == NULL || page->separation_disabled == NULL) + return 0; + + return page->separation_disabled(ctx, page, sep); +} + const char *fz_get_separation_on_page(fz_context *ctx, fz_page *page, int sep, uint32_t *rgba, uint32_t *cmyk) { if (ctx == NULL || page == NULL || page->get_separation == NULL) diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c index 32fee4dc..8126e040 100644 --- a/source/gprf/gprf-doc.c +++ b/source/gprf/gprf-doc.c @@ -769,10 +769,17 @@ static int gprf_count_separations(fz_context *ctx, fz_page *page_) static void gprf_control_separation(fz_context *ctx, fz_page *page_, int sep, int disable) { gprf_page *page = (gprf_page *)page_; - + fz_control_separation(ctx, page->separations, sep, disable); } +static int gprf_separation_disabled(fz_context *ctx, fz_page *page_, int sep) +{ + gprf_page *page = (gprf_page *)page_; + + return fz_separation_disabled(ctx, page->separations, sep); +} + static const char *gprf_get_separation(fz_context *ctx, fz_page *page_, int sep, uint32_t *rgba, uint32_t*cmyk) { gprf_page *page = (gprf_page *)page_; @@ -793,6 +800,7 @@ gprf_load_page(fz_context *ctx, fz_document *doc_, int number) page->super.drop_page_imp = gprf_drop_page_imp; page->super.count_separations = gprf_count_separations; page->super.control_separation = gprf_control_separation; + page->super.separation_disabled = gprf_separation_disabled; page->super.get_separation = gprf_get_separation; page->doc = (gprf_document *)fz_keep_document(ctx, &doc->super); page->number = number; |