summaryrefslogtreecommitdiff
path: root/source/fitz/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/fitz/util.c')
-rw-r--r--source/fitz/util.c54
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)
{