pdfium_render/pdf/document/page/annotation/
stamp.rs1use crate::bindgen::{FPDF_ANNOTATION, FPDF_DOCUMENT, FPDF_PAGE};
5use crate::bindings::PdfiumLibraryBindings;
6use crate::pdf::document::page::annotation::attachment_points::PdfPageAnnotationAttachmentPoints;
7use crate::pdf::document::page::annotation::objects::PdfPageAnnotationObjects;
8use crate::pdf::document::page::annotation::private::internal::PdfPageAnnotationPrivate;
9use crate::pdf::document::page::object::ownership::PdfPageObjectOwnership;
10use crate::pdf::document::page::objects::private::internal::PdfPageObjectsPrivate;
11
12#[cfg(doc)]
13use crate::pdf::document::page::annotation::{PdfPageAnnotation, PdfPageAnnotationType};
14
15pub struct PdfPageStampAnnotation<'a> {
17 handle: FPDF_ANNOTATION,
18 objects: PdfPageAnnotationObjects<'a>,
19 attachment_points: PdfPageAnnotationAttachmentPoints<'a>,
20 bindings: &'a dyn PdfiumLibraryBindings,
21}
22
23impl<'a> PdfPageStampAnnotation<'a> {
24 pub(crate) fn from_pdfium(
25 document_handle: FPDF_DOCUMENT,
26 page_handle: FPDF_PAGE,
27 annotation_handle: FPDF_ANNOTATION,
28 bindings: &'a dyn PdfiumLibraryBindings,
29 ) -> Self {
30 PdfPageStampAnnotation {
31 handle: annotation_handle,
32 objects: PdfPageAnnotationObjects::from_pdfium(document_handle, page_handle, annotation_handle, bindings),
33 attachment_points: PdfPageAnnotationAttachmentPoints::from_pdfium(annotation_handle, bindings),
34 bindings,
35 }
36 }
37
38 #[inline]
40 pub fn objects_mut(&mut self) -> &mut PdfPageAnnotationObjects<'a> {
41 &mut self.objects
42 }
43}
44
45impl<'a> PdfPageAnnotationPrivate<'a> for PdfPageStampAnnotation<'a> {
46 #[inline]
47 fn handle(&self) -> FPDF_ANNOTATION {
48 self.handle
49 }
50
51 #[inline]
52 fn ownership(&self) -> &PdfPageObjectOwnership {
53 self.objects_impl().ownership()
54 }
55
56 #[inline]
57 fn bindings(&self) -> &dyn PdfiumLibraryBindings {
58 self.bindings
59 }
60
61 #[inline]
62 fn objects_impl(&self) -> &PdfPageAnnotationObjects<'_> {
63 &self.objects
64 }
65
66 #[inline]
67 fn attachment_points_impl(&self) -> &PdfPageAnnotationAttachmentPoints<'_> {
68 &self.attachment_points
69 }
70}