diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-02-27 18:36:07 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-03-16 14:51:41 +0100 |
commit | e26a2c26ede734978224294f7f77fd7f067eda53 (patch) | |
tree | 0690a0920c71783d2f06ff01deb324a59a32ecfc /source/pdf/pdf-annot-edit.c | |
parent | df788749fd2377e0c0232bac447e369e59c98b75 (diff) | |
download | mupdf-e26a2c26ede734978224294f7f77fd7f067eda53.tar.xz |
Add annotation opacity accessor.
Diffstat (limited to 'source/pdf/pdf-annot-edit.c')
-rw-r--r-- | source/pdf/pdf-annot-edit.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 1d042f1f..799fb9b7 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -479,6 +479,23 @@ pdf_set_annot_border(fz_context *ctx, pdf_annot *annot, float w) pdf_dirty_annot(ctx, annot); } +float pdf_annot_opacity(fz_context *ctx, pdf_annot *annot) +{ + pdf_obj *ca = pdf_dict_get(ctx, annot->obj, PDF_NAME_CA); + if (pdf_is_number(ctx, ca)) + return pdf_to_real(ctx, ca); + return 1; +} + +void pdf_set_annot_opacity(fz_context *ctx, pdf_annot *annot, float opacity) +{ + if (opacity != 1) + pdf_dict_put_real(ctx, annot->obj, PDF_NAME_CA, opacity); + else + pdf_dict_del(ctx, annot->obj, PDF_NAME_CA); + pdf_dirty_annot(ctx, annot); +} + static void pdf_annot_color_imp(fz_context *ctx, pdf_annot *annot, pdf_obj *key, int *n, float color[4], pdf_obj **allowed) { pdf_obj *arr; |