objc2_core_graphics/generated/
CGPDFPage.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13#[doc(alias = "CGPDFPageRef")]
15#[repr(C)]
16pub struct CGPDFPage {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21cf_type!(
22 unsafe impl CGPDFPage {}
23);
24#[cfg(feature = "objc2")]
25cf_objc2_type!(
26 unsafe impl RefEncode<"CGPDFPage"> for CGPDFPage {}
27);
28
29#[repr(transparent)]
32#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33pub struct CGPDFBox(pub i32);
34impl CGPDFBox {
35 #[doc(alias = "kCGPDFMediaBox")]
36 pub const MediaBox: Self = Self(0);
37 #[doc(alias = "kCGPDFCropBox")]
38 pub const CropBox: Self = Self(1);
39 #[doc(alias = "kCGPDFBleedBox")]
40 pub const BleedBox: Self = Self(2);
41 #[doc(alias = "kCGPDFTrimBox")]
42 pub const TrimBox: Self = Self(3);
43 #[doc(alias = "kCGPDFArtBox")]
44 pub const ArtBox: Self = Self(4);
45}
46
47#[cfg(feature = "objc2")]
48unsafe impl Encode for CGPDFBox {
49 const ENCODING: Encoding = i32::ENCODING;
50}
51
52#[cfg(feature = "objc2")]
53unsafe impl RefEncode for CGPDFBox {
54 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57impl CGPDFPage {
58 #[doc(alias = "CGPDFPageGetDocument")]
59 #[cfg(feature = "CGPDFDocument")]
60 #[inline]
61 pub fn document(page: Option<&CGPDFPage>) -> Option<CFRetained<CGPDFDocument>> {
62 extern "C-unwind" {
63 fn CGPDFPageGetDocument(page: Option<&CGPDFPage>) -> Option<NonNull<CGPDFDocument>>;
64 }
65 let ret = unsafe { CGPDFPageGetDocument(page) };
66 ret.map(|ret| unsafe { CFRetained::retain(ret) })
67 }
68
69 #[doc(alias = "CGPDFPageGetPageNumber")]
70 #[inline]
71 pub fn page_number(page: Option<&CGPDFPage>) -> usize {
72 extern "C-unwind" {
73 fn CGPDFPageGetPageNumber(page: Option<&CGPDFPage>) -> usize;
74 }
75 unsafe { CGPDFPageGetPageNumber(page) }
76 }
77
78 #[doc(alias = "CGPDFPageGetBoxRect")]
79 #[inline]
80 pub fn box_rect(page: Option<&CGPDFPage>, r#box: CGPDFBox) -> CGRect {
81 extern "C-unwind" {
82 fn CGPDFPageGetBoxRect(page: Option<&CGPDFPage>, r#box: CGPDFBox) -> CGRect;
83 }
84 unsafe { CGPDFPageGetBoxRect(page, r#box) }
85 }
86
87 #[doc(alias = "CGPDFPageGetRotationAngle")]
88 #[inline]
89 pub fn rotation_angle(page: Option<&CGPDFPage>) -> c_int {
90 extern "C-unwind" {
91 fn CGPDFPageGetRotationAngle(page: Option<&CGPDFPage>) -> c_int;
92 }
93 unsafe { CGPDFPageGetRotationAngle(page) }
94 }
95
96 #[doc(alias = "CGPDFPageGetDrawingTransform")]
97 #[inline]
98 pub fn drawing_transform(
99 page: Option<&CGPDFPage>,
100 r#box: CGPDFBox,
101 rect: CGRect,
102 rotate: c_int,
103 preserve_aspect_ratio: bool,
104 ) -> CGAffineTransform {
105 extern "C-unwind" {
106 fn CGPDFPageGetDrawingTransform(
107 page: Option<&CGPDFPage>,
108 r#box: CGPDFBox,
109 rect: CGRect,
110 rotate: c_int,
111 preserve_aspect_ratio: bool,
112 ) -> CGAffineTransform;
113 }
114 unsafe { CGPDFPageGetDrawingTransform(page, r#box, rect, rotate, preserve_aspect_ratio) }
115 }
116
117 #[doc(alias = "CGPDFPageGetDictionary")]
118 #[cfg(feature = "CGPDFDictionary")]
119 #[inline]
120 pub fn dictionary(page: Option<&CGPDFPage>) -> CGPDFDictionaryRef {
121 extern "C-unwind" {
122 fn CGPDFPageGetDictionary(page: Option<&CGPDFPage>) -> CGPDFDictionaryRef;
123 }
124 unsafe { CGPDFPageGetDictionary(page) }
125 }
126}
127
128unsafe impl ConcreteType for CGPDFPage {
129 #[doc(alias = "CGPDFPageGetTypeID")]
130 #[inline]
131 fn type_id() -> CFTypeID {
132 extern "C-unwind" {
133 fn CGPDFPageGetTypeID() -> CFTypeID;
134 }
135 unsafe { CGPDFPageGetTypeID() }
136 }
137}
138
139#[cfg(feature = "CGPDFDocument")]
140#[deprecated = "renamed to `CGPDFPage::document`"]
141#[inline]
142pub extern "C-unwind" fn CGPDFPageGetDocument(
143 page: Option<&CGPDFPage>,
144) -> Option<CFRetained<CGPDFDocument>> {
145 extern "C-unwind" {
146 fn CGPDFPageGetDocument(page: Option<&CGPDFPage>) -> Option<NonNull<CGPDFDocument>>;
147 }
148 let ret = unsafe { CGPDFPageGetDocument(page) };
149 ret.map(|ret| unsafe { CFRetained::retain(ret) })
150}
151
152#[deprecated = "renamed to `CGPDFPage::page_number`"]
153#[inline]
154pub extern "C-unwind" fn CGPDFPageGetPageNumber(page: Option<&CGPDFPage>) -> usize {
155 extern "C-unwind" {
156 fn CGPDFPageGetPageNumber(page: Option<&CGPDFPage>) -> usize;
157 }
158 unsafe { CGPDFPageGetPageNumber(page) }
159}
160
161#[deprecated = "renamed to `CGPDFPage::box_rect`"]
162#[inline]
163pub extern "C-unwind" fn CGPDFPageGetBoxRect(page: Option<&CGPDFPage>, r#box: CGPDFBox) -> CGRect {
164 extern "C-unwind" {
165 fn CGPDFPageGetBoxRect(page: Option<&CGPDFPage>, r#box: CGPDFBox) -> CGRect;
166 }
167 unsafe { CGPDFPageGetBoxRect(page, r#box) }
168}
169
170#[deprecated = "renamed to `CGPDFPage::rotation_angle`"]
171#[inline]
172pub extern "C-unwind" fn CGPDFPageGetRotationAngle(page: Option<&CGPDFPage>) -> c_int {
173 extern "C-unwind" {
174 fn CGPDFPageGetRotationAngle(page: Option<&CGPDFPage>) -> c_int;
175 }
176 unsafe { CGPDFPageGetRotationAngle(page) }
177}
178
179#[deprecated = "renamed to `CGPDFPage::drawing_transform`"]
180#[inline]
181pub extern "C-unwind" fn CGPDFPageGetDrawingTransform(
182 page: Option<&CGPDFPage>,
183 r#box: CGPDFBox,
184 rect: CGRect,
185 rotate: c_int,
186 preserve_aspect_ratio: bool,
187) -> CGAffineTransform {
188 extern "C-unwind" {
189 fn CGPDFPageGetDrawingTransform(
190 page: Option<&CGPDFPage>,
191 r#box: CGPDFBox,
192 rect: CGRect,
193 rotate: c_int,
194 preserve_aspect_ratio: bool,
195 ) -> CGAffineTransform;
196 }
197 unsafe { CGPDFPageGetDrawingTransform(page, r#box, rect, rotate, preserve_aspect_ratio) }
198}
199
200#[cfg(feature = "CGPDFDictionary")]
201#[deprecated = "renamed to `CGPDFPage::dictionary`"]
202#[inline]
203pub extern "C-unwind" fn CGPDFPageGetDictionary(page: Option<&CGPDFPage>) -> CGPDFDictionaryRef {
204 extern "C-unwind" {
205 fn CGPDFPageGetDictionary(page: Option<&CGPDFPage>) -> CGPDFDictionaryRef;
206 }
207 unsafe { CGPDFPageGetDictionary(page) }
208}