summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-07-06 14:20:26 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-08-10 12:09:10 +0200
commit0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30 (patch)
tree8fe312208afaf28e2d759f4a1c53ec4ef131124f /include
parent6f8cb5606e426084160eaec82e9c11966e7fb5f4 (diff)
downloadmupdf-0abcccc4aab4d893ac2a0ef116ff1f0c006fbc30.tar.xz
Rejig pdf_update_page and pdf_update_annot.
The intent is for a user to iterate over the annotations on a page calling pdf_update_annot for each one. If this function returns true, then the annotation has changed since the last time it was called, and the user needs to re-render. pdf_update_page is a simple loop over the annotations on a page, for use if you only care about page level granularity. Users should no longer look at or change the pdf_annot.has_new_ap field.
Diffstat (limited to 'include')
-rw-r--r--include/mupdf/pdf/annot.h36
-rw-r--r--include/mupdf/pdf/document.h20
2 files changed, 33 insertions, 23 deletions
diff --git a/include/mupdf/pdf/annot.h b/include/mupdf/pdf/annot.h
index 5a97c4d5..adaf51c6 100644
--- a/include/mupdf/pdf/annot.h
+++ b/include/mupdf/pdf/annot.h
@@ -134,7 +134,6 @@ fz_link *pdf_load_link_annots(fz_context *ctx, pdf_document *, pdf_obj *annots,
fz_matrix pdf_annot_transform(fz_context *ctx, pdf_annot *annot);
void pdf_load_annots(fz_context *ctx, pdf_page *page, pdf_obj *annots);
-void pdf_update_annot(fz_context *ctx, pdf_annot *annot);
void pdf_drop_annots(fz_context *ctx, pdf_annot *annot_list);
/*
@@ -261,10 +260,41 @@ void pdf_set_annot_default_appearance(fz_context *ctx, pdf_annot *annot, const c
pdf_new_annot: Internal function for creating a new pdf annotation.
*/
pdf_annot *pdf_new_annot(fz_context *ctx, pdf_page *page, pdf_obj *obj);
-
-void pdf_update_appearance(fz_context *ctx, pdf_annot *annot);
void pdf_dirty_annot(fz_context *ctx, pdf_annot *annot);
+/*
+ Recreate the appearance stream for an annotation.
+*/
+void pdf_update_appearance(fz_context *ctx, pdf_annot *annot);
void pdf_update_signature_appearance(fz_context *ctx, pdf_annot *annot, const char *name, const char *text, const char *date);
+/*
+ Regenerate any appearance streams that are out of date and check for
+ cases where a different appearance stream should be selected because of
+ state changes.
+
+ Note that a call to pdf_pass_event for one page may lead to changes on
+ any other, so an app should call pdf_update_annot for every annotation
+ it currently displays. Also it is important that the pdf_annot object
+ is the one used to last render the annotation. If instead the app were
+ to drop the page or annotations and reload them then a call to
+ pdf_update_annot would not reliably be able to report all changed
+ annotations.
+
+ Returns true if the annotation appearance has changed since the last time
+ pdf_update_annot was called or the annotation was first loaded.
+*/
+int pdf_update_annot(fz_context *ctx, pdf_annot *annot);
+
+/*
+ Loop through all annotations on the page and update them. Return true
+ if any of them were changed (by either event or javascript actions, or
+ by annotation editing) and need re-rendering.
+
+ If you need more granularity, loop through the annotations and call
+ pdf_update_annot for each one to detect changes on a per-annotation
+ basis.
+*/
+int pdf_update_page(fz_context *ctx, pdf_page *page);
+
#endif
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h
index 24e3aaed..9e9121df 100644
--- a/include/mupdf/pdf/document.h
+++ b/include/mupdf/pdf/document.h
@@ -514,26 +514,6 @@ int pdf_add_portfolio_entry(fz_context *ctx, pdf_document *doc,
void pdf_set_portfolio_entry_info(fz_context *ctx, pdf_document *doc, int entry, int schema_entry, pdf_obj *data);
/*
- pdf_update_page: Update a page for the sake of changes caused by a call
- to pdf_pass_event or annotation editing functions.
-
- pdf_update_page regenerates any appearance streams that are out of
- date, checks for cases where different appearance streams should be
- selected because of state changes, and records internally each
- annotation that has changed appearance.
-
- Each annotation that has changed has its has_new_ap flag set to true.
-
- Note that a call to pdf_pass_event for one page may lead to changes on
- any other, so an app should call pdf_update_page for every page it
- currently displays. Also it is important that the pdf_page object is
- the one used to last render the page. If instead the app were to drop
- the page and reload it then a call to pdf_update_page would not
- reliably be able to report all changed areas.
-*/
-int pdf_update_page(fz_context *ctx, pdf_page *page);
-
-/*
Determine whether changes have been made since the
document was opened or last saved.
*/