summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2015-07-20 19:25:28 +0100
committerRobin Watts <robin.watts@artifex.com>2015-08-17 12:34:33 +0100
commit88003e46fa0db666d4cbccdfa81857ca7853e55f (patch)
tree51ecec7126a2e0c058b7e53d9ac41dfca5f685f1 /source
parentffcd1d4b197a33c7d2d9f500451a2a40b52c23e9 (diff)
downloadmupdf-88003e46fa0db666d4cbccdfa81857ca7853e55f.tar.xz
Add JNI interface to MuPDFCore to read/write separations on a page.
Get separation information out to the Java level.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/document.c28
-rw-r--r--source/gprf/gprf-doc.c23
2 files changed, 51 insertions, 0 deletions
diff --git a/source/fitz/document.c b/source/fitz/document.c
index 78bd707c..9c78187f 100644
--- a/source/fitz/document.c
+++ b/source/fitz/document.c
@@ -408,3 +408,31 @@ fz_page_presentation(fz_context *ctx, fz_page *page, float *duration)
return page->page_presentation(ctx, page, duration);
return NULL;
}
+
+int fz_count_separations_on_page(fz_context *ctx, fz_page *page)
+{
+ if (ctx == NULL || page == NULL || page->count_separations == NULL)
+ return 0;
+
+ return page->count_separations(ctx, page);
+}
+
+void fz_control_separation_on_page(fz_context *ctx, fz_page *page, int sep, int disable)
+{
+ if (ctx == NULL || page == NULL || page->control_separation == NULL)
+ return;
+
+ page->control_separation(ctx, page, sep, disable);
+}
+
+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)
+ {
+ *rgba = 0;
+ *cmyk = 0;
+ return NULL;
+ }
+
+ return page->get_separation(ctx, page, sep, rgba, cmyk);
+}
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 07714b8a..02562ca7 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -654,6 +654,26 @@ gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix *
fz_render_flags(ctx, dev, 0, FZ_DEVFLAG_GRIDFIT_AS_TILED);
}
+static int gprf_count_separations(fz_context *ctx, fz_page *page_)
+{
+ gprf_page *page = (gprf_page *)page_;
+
+ return fz_count_separations(ctx, page->separations);
+}
+
+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 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_;
+
+ return fz_get_separation(ctx, page->separations, sep, rgba, cmyk);
+}
static fz_page *
gprf_load_page(fz_context *ctx, fz_document *doc_, int number)
@@ -666,6 +686,9 @@ gprf_load_page(fz_context *ctx, fz_document *doc_, int number)
page->super.bound_page = gprf_bound_page;
page->super.run_page_contents = gprf_run_page;
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.get_separation = gprf_get_separation;
page->doc = (gprf_document *)fz_keep_document(ctx, &doc->super);
page->number = number;
page->separations = fz_new_separations(ctx);