diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-07-04 13:38:18 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-07-06 15:45:40 +0200 |
commit | 4d13ba9adbe46fc84fea662b906347bfa90ce208 (patch) | |
tree | 3cb349e60b97ced79c37fed937787f4a4dc6ab4e /source/fitz/util.c | |
parent | 7a8be5d456254c6edbf1009a87281c1c963f951a (diff) | |
download | mupdf-4d13ba9adbe46fc84fea662b906347bfa90ce208.tar.xz |
Add annotations to murun.
Diffstat (limited to 'source/fitz/util.c')
-rw-r--r-- | source/fitz/util.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/source/fitz/util.c b/source/fitz/util.c index e1e17c25..f76e496a 100644 --- a/source/fitz/util.c +++ b/source/fitz/util.c @@ -43,6 +43,60 @@ fz_new_display_list_from_page_number(fz_context *ctx, fz_document *doc, int numb return list; } +fz_display_list * +fz_new_display_list_from_page_contents(fz_context *ctx, fz_page *page) +{ + fz_display_list *list; + fz_rect bounds; + fz_device *dev; + + list = fz_new_display_list(ctx, fz_bound_page(ctx, page, &bounds)); + + fz_try(ctx) + { + dev = fz_new_list_device(ctx, list); + fz_run_page_contents(ctx, page, dev, &fz_identity, NULL); + } + fz_always(ctx) + { + fz_drop_device(ctx, dev); + } + fz_catch(ctx) + { + fz_drop_display_list(ctx, list); + fz_rethrow(ctx); + } + + return list; +} + +fz_display_list * +fz_new_display_list_from_annot(fz_context *ctx, fz_annot *annot) +{ + fz_display_list *list; + fz_rect bounds; + fz_device *dev; + + list = fz_new_display_list(ctx, fz_bound_annot(ctx, annot, &bounds)); + + fz_try(ctx) + { + dev = fz_new_list_device(ctx, list); + fz_run_annot(ctx, annot, dev, &fz_identity, NULL); + } + fz_always(ctx) + { + fz_drop_device(ctx, dev); + } + fz_catch(ctx) + { + fz_drop_display_list(ctx, list); + fz_rethrow(ctx); + } + + return list; +} + fz_pixmap * fz_new_pixmap_from_display_list(fz_context *ctx, fz_display_list *list, const fz_matrix *ctm, fz_colorspace *cs, int alpha) { |