pdfium_render/pdf/document/page/annotation/
ink.rs1use crate::bindgen::{FPDF_ANNOTATION, FPDF_DOCUMENT, FPDF_PAGE};
5use crate::pdf::document::page::annotation::attachment_points::PdfPageAnnotationAttachmentPoints;
6use crate::pdf::document::page::annotation::objects::PdfPageAnnotationObjects;
7use crate::pdf::document::page::annotation::private::internal::PdfPageAnnotationPrivate;
8use crate::pdf::document::page::object::ownership::PdfPageObjectOwnership;
9use crate::pdf::document::page::objects::private::internal::PdfPageObjectsPrivate;
10use crate::pdfium::PdfiumLibraryBindingsAccessor;
11use std::marker::PhantomData;
12
13#[cfg(doc)]
14use {
15 crate::pdf::document::page::annotation::PdfPageAnnotation,
16 crate::pdf::document::page::annotation::PdfPageAnnotationType,
17};
18
19pub struct PdfPageInkAnnotation<'a> {
21 handle: FPDF_ANNOTATION,
22 objects: PdfPageAnnotationObjects<'a>,
23 attachment_points: PdfPageAnnotationAttachmentPoints<'a>,
24 lifetime: PhantomData<&'a FPDF_ANNOTATION>,
25}
26
27impl<'a> PdfPageInkAnnotation<'a> {
28 pub(crate) fn from_pdfium(
29 document_handle: FPDF_DOCUMENT,
30 page_handle: FPDF_PAGE,
31 annotation_handle: FPDF_ANNOTATION,
32 ) -> Self {
33 PdfPageInkAnnotation {
34 handle: annotation_handle,
35 objects: PdfPageAnnotationObjects::from_pdfium(
36 document_handle,
37 page_handle,
38 annotation_handle,
39 ),
40 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(annotation_handle),
41 lifetime: PhantomData,
42 }
43 }
44
45 #[inline]
47 pub fn objects_mut(&mut self) -> &mut PdfPageAnnotationObjects<'a> {
48 &mut self.objects
49 }
50}
51
52impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageInkAnnotation<'a> {
53 #[inline]
54 fn handle(&self) -> FPDF_ANNOTATION {
55 self.handle
56 }
57
58 #[inline]
59 fn ownership(&self) -> &PdfPageObjectOwnership {
60 self.objects_impl().ownership()
61 }
62
63 #[inline]
64 fn objects_impl(&self) -> &PdfPageAnnotationObjects<'_> {
65 &self.objects
66 }
67
68 #[inline]
69 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints<'_> {
70 &self.attachment_points
71 }
72}
73
74impl<'a> PdfiumLibraryBindingsAccessor<'a> for PdfPageInkAnnotation<'a> {}
75
76#[cfg(feature = "thread_safe")]
77unsafe impl<'a> Send for PdfPageInkAnnotation<'a> {}
78
79#[cfg(feature = "thread_safe")]
80unsafe impl<'a> Sync for PdfPageInkAnnotation<'a> {}