objc2_core_graphics/generated/
CGPDFContext.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// # Safety
12///
13/// - `media_box` must be a valid pointer or null.
14/// - `auxiliary_info` generics must be of the correct type.
15#[cfg(all(feature = "CGContext", feature = "CGDataConsumer"))]
16#[inline]
17pub unsafe extern "C-unwind" fn CGPDFContextCreate(
18    consumer: Option<&CGDataConsumer>,
19    media_box: *const CGRect,
20    auxiliary_info: Option<&CFDictionary>,
21) -> Option<CFRetained<CGContext>> {
22    extern "C-unwind" {
23        fn CGPDFContextCreate(
24            consumer: Option<&CGDataConsumer>,
25            media_box: *const CGRect,
26            auxiliary_info: Option<&CFDictionary>,
27        ) -> Option<NonNull<CGContext>>;
28    }
29    let ret = unsafe { CGPDFContextCreate(consumer, media_box, auxiliary_info) };
30    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
31}
32
33/// # Safety
34///
35/// - `media_box` must be a valid pointer or null.
36/// - `auxiliary_info` generics must be of the correct type.
37#[cfg(feature = "CGContext")]
38#[inline]
39pub unsafe extern "C-unwind" fn CGPDFContextCreateWithURL(
40    url: Option<&CFURL>,
41    media_box: *const CGRect,
42    auxiliary_info: Option<&CFDictionary>,
43) -> Option<CFRetained<CGContext>> {
44    extern "C-unwind" {
45        fn CGPDFContextCreateWithURL(
46            url: Option<&CFURL>,
47            media_box: *const CGRect,
48            auxiliary_info: Option<&CFDictionary>,
49        ) -> Option<NonNull<CGContext>>;
50    }
51    let ret = unsafe { CGPDFContextCreateWithURL(url, media_box, auxiliary_info) };
52    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
53}
54
55#[cfg(feature = "CGContext")]
56#[inline]
57pub extern "C-unwind" fn CGPDFContextClose(context: Option<&CGContext>) {
58    extern "C-unwind" {
59        fn CGPDFContextClose(context: Option<&CGContext>);
60    }
61    unsafe { CGPDFContextClose(context) }
62}
63
64extern "C-unwind" {
65    /// # Safety
66    ///
67    /// `page_info` generics must be of the correct type.
68    #[cfg(feature = "CGContext")]
69    pub fn CGPDFContextBeginPage(context: Option<&CGContext>, page_info: Option<&CFDictionary>);
70}
71
72#[cfg(feature = "CGContext")]
73#[inline]
74pub extern "C-unwind" fn CGPDFContextEndPage(context: Option<&CGContext>) {
75    extern "C-unwind" {
76        fn CGPDFContextEndPage(context: Option<&CGContext>);
77    }
78    unsafe { CGPDFContextEndPage(context) }
79}
80
81#[cfg(feature = "CGContext")]
82#[inline]
83pub extern "C-unwind" fn CGPDFContextAddDocumentMetadata(
84    context: Option<&CGContext>,
85    metadata: Option<&CFData>,
86) {
87    extern "C-unwind" {
88        fn CGPDFContextAddDocumentMetadata(context: Option<&CGContext>, metadata: Option<&CFData>);
89    }
90    unsafe { CGPDFContextAddDocumentMetadata(context, metadata) }
91}
92
93extern "C-unwind" {
94    /// # Safety
95    ///
96    /// `parent_tree_dictionary` must be a valid pointer.
97    #[cfg(all(feature = "CGContext", feature = "CGPDFDictionary"))]
98    pub fn CGPDFContextSetParentTree(
99        context: Option<&CGContext>,
100        parent_tree_dictionary: CGPDFDictionaryRef,
101    );
102}
103
104extern "C-unwind" {
105    /// # Safety
106    ///
107    /// `id_tree_dictionary` must be a valid pointer.
108    #[cfg(all(feature = "CGContext", feature = "CGPDFDictionary"))]
109    pub fn CGPDFContextSetIDTree(
110        context: Option<&CGContext>,
111        id_tree_dictionary: CGPDFDictionaryRef,
112    );
113}
114
115extern "C-unwind" {
116    /// # Safety
117    ///
118    /// `page_tag_structure_tree_dictionary` generics must be of the correct type.
119    #[cfg(feature = "CGContext")]
120    pub fn CGPDFContextSetPageTagStructureTree(
121        context: Option<&CGContext>,
122        page_tag_structure_tree_dictionary: &CFDictionary,
123    );
124}
125
126#[cfg(feature = "CGContext")]
127#[inline]
128pub extern "C-unwind" fn CGPDFContextSetURLForRect(
129    context: Option<&CGContext>,
130    url: &CFURL,
131    rect: CGRect,
132) {
133    extern "C-unwind" {
134        fn CGPDFContextSetURLForRect(context: Option<&CGContext>, url: &CFURL, rect: CGRect);
135    }
136    unsafe { CGPDFContextSetURLForRect(context, url, rect) }
137}
138
139#[cfg(feature = "CGContext")]
140#[inline]
141pub extern "C-unwind" fn CGPDFContextAddDestinationAtPoint(
142    context: Option<&CGContext>,
143    name: &CFString,
144    point: CGPoint,
145) {
146    extern "C-unwind" {
147        fn CGPDFContextAddDestinationAtPoint(
148            context: Option<&CGContext>,
149            name: &CFString,
150            point: CGPoint,
151        );
152    }
153    unsafe { CGPDFContextAddDestinationAtPoint(context, name, point) }
154}
155
156#[cfg(feature = "CGContext")]
157#[inline]
158pub extern "C-unwind" fn CGPDFContextSetDestinationForRect(
159    context: Option<&CGContext>,
160    name: &CFString,
161    rect: CGRect,
162) {
163    extern "C-unwind" {
164        fn CGPDFContextSetDestinationForRect(
165            context: Option<&CGContext>,
166            name: &CFString,
167            rect: CGRect,
168        );
169    }
170    unsafe { CGPDFContextSetDestinationForRect(context, name, rect) }
171}
172
173extern "C" {
174    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextmediabox?language=objc)
175    pub static kCGPDFContextMediaBox: &'static CFString;
176}
177
178extern "C" {
179    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcropbox?language=objc)
180    pub static kCGPDFContextCropBox: &'static CFString;
181}
182
183extern "C" {
184    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextbleedbox?language=objc)
185    pub static kCGPDFContextBleedBox: &'static CFString;
186}
187
188extern "C" {
189    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontexttrimbox?language=objc)
190    pub static kCGPDFContextTrimBox: &'static CFString;
191}
192
193extern "C" {
194    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextartbox?language=objc)
195    pub static kCGPDFContextArtBox: &'static CFString;
196}
197
198extern "C" {
199    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontexttitle?language=objc)
200    pub static kCGPDFContextTitle: &'static CFString;
201}
202
203extern "C" {
204    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextauthor?language=objc)
205    pub static kCGPDFContextAuthor: &'static CFString;
206}
207
208extern "C" {
209    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextsubject?language=objc)
210    pub static kCGPDFContextSubject: &'static CFString;
211}
212
213extern "C" {
214    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextkeywords?language=objc)
215    pub static kCGPDFContextKeywords: &'static CFString;
216}
217
218extern "C" {
219    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreator?language=objc)
220    pub static kCGPDFContextCreator: &'static CFString;
221}
222
223extern "C" {
224    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextownerpassword?language=objc)
225    pub static kCGPDFContextOwnerPassword: &'static CFString;
226}
227
228extern "C" {
229    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextuserpassword?language=objc)
230    pub static kCGPDFContextUserPassword: &'static CFString;
231}
232
233extern "C" {
234    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextencryptionkeylength?language=objc)
235    pub static kCGPDFContextEncryptionKeyLength: &'static CFString;
236}
237
238extern "C" {
239    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextallowsprinting?language=objc)
240    pub static kCGPDFContextAllowsPrinting: &'static CFString;
241}
242
243extern "C" {
244    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextallowscopying?language=objc)
245    pub static kCGPDFContextAllowsCopying: &'static CFString;
246}
247
248extern "C" {
249    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextoutputintent?language=objc)
250    pub static kCGPDFContextOutputIntent: &'static CFString;
251}
252
253extern "C" {
254    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputintentsubtype?language=objc)
255    pub static kCGPDFXOutputIntentSubtype: &'static CFString;
256}
257
258extern "C" {
259    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputconditionidentifier?language=objc)
260    pub static kCGPDFXOutputConditionIdentifier: &'static CFString;
261}
262
263extern "C" {
264    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputcondition?language=objc)
265    pub static kCGPDFXOutputCondition: &'static CFString;
266}
267
268extern "C" {
269    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxregistryname?language=objc)
270    pub static kCGPDFXRegistryName: &'static CFString;
271}
272
273extern "C" {
274    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxinfo?language=objc)
275    pub static kCGPDFXInfo: &'static CFString;
276}
277
278extern "C" {
279    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxdestinationoutputprofile?language=objc)
280    pub static kCGPDFXDestinationOutputProfile: &'static CFString;
281}
282
283extern "C" {
284    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextoutputintents?language=objc)
285    pub static kCGPDFContextOutputIntents: &'static CFString;
286}
287
288extern "C" {
289    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextaccesspermissions?language=objc)
290    pub static kCGPDFContextAccessPermissions: &'static CFString;
291}
292
293extern "C-unwind" {
294    /// # Safety
295    ///
296    /// `outline` generics must be of the correct type.
297    #[cfg(feature = "CGContext")]
298    pub fn CGPDFContextSetOutline(context: &CGContext, outline: Option<&CFDictionary>);
299}
300
301extern "C" {
302    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreatelinearizedpdf?language=objc)
303    pub static kCGPDFContextCreateLinearizedPDF: &'static CFString;
304}
305
306extern "C" {
307    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreatepdfa?language=objc)
308    pub static kCGPDFContextCreatePDFA: &'static CFString;
309}
310
311/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdftagtype?language=objc)
312// NS_ENUM
313#[repr(transparent)]
314#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
315pub struct CGPDFTagType(pub i32);
316impl CGPDFTagType {
317    #[doc(alias = "CGPDFTagTypeDocument")]
318    pub const Document: Self = Self(100);
319    #[doc(alias = "CGPDFTagTypePart")]
320    pub const Part: Self = Self(101);
321    #[doc(alias = "CGPDFTagTypeArt")]
322    pub const Art: Self = Self(102);
323    #[doc(alias = "CGPDFTagTypeSection")]
324    pub const Section: Self = Self(103);
325    #[doc(alias = "CGPDFTagTypeDiv")]
326    pub const Div: Self = Self(104);
327    #[doc(alias = "CGPDFTagTypeBlockQuote")]
328    pub const BlockQuote: Self = Self(105);
329    #[doc(alias = "CGPDFTagTypeCaption")]
330    pub const Caption: Self = Self(106);
331    #[doc(alias = "CGPDFTagTypeTOC")]
332    pub const TOC: Self = Self(107);
333    #[doc(alias = "CGPDFTagTypeTOCI")]
334    pub const TOCI: Self = Self(108);
335    #[doc(alias = "CGPDFTagTypeIndex")]
336    pub const Index: Self = Self(109);
337    #[doc(alias = "CGPDFTagTypeNonStructure")]
338    pub const NonStructure: Self = Self(110);
339    #[doc(alias = "CGPDFTagTypePrivate")]
340    pub const Private: Self = Self(111);
341    #[doc(alias = "CGPDFTagTypeParagraph")]
342    pub const Paragraph: Self = Self(200);
343    #[doc(alias = "CGPDFTagTypeHeader")]
344    pub const Header: Self = Self(201);
345    #[doc(alias = "CGPDFTagTypeHeader1")]
346    pub const Header1: Self = Self(202);
347    #[doc(alias = "CGPDFTagTypeHeader2")]
348    pub const Header2: Self = Self(203);
349    #[doc(alias = "CGPDFTagTypeHeader3")]
350    pub const Header3: Self = Self(204);
351    #[doc(alias = "CGPDFTagTypeHeader4")]
352    pub const Header4: Self = Self(205);
353    #[doc(alias = "CGPDFTagTypeHeader5")]
354    pub const Header5: Self = Self(206);
355    #[doc(alias = "CGPDFTagTypeHeader6")]
356    pub const Header6: Self = Self(207);
357    #[doc(alias = "CGPDFTagTypeList")]
358    pub const List: Self = Self(300);
359    #[doc(alias = "CGPDFTagTypeListItem")]
360    pub const ListItem: Self = Self(301);
361    #[doc(alias = "CGPDFTagTypeLabel")]
362    pub const Label: Self = Self(302);
363    #[doc(alias = "CGPDFTagTypeListBody")]
364    pub const ListBody: Self = Self(303);
365    #[doc(alias = "CGPDFTagTypeTable")]
366    pub const Table: Self = Self(400);
367    #[doc(alias = "CGPDFTagTypeTableRow")]
368    pub const TableRow: Self = Self(401);
369    #[doc(alias = "CGPDFTagTypeTableHeaderCell")]
370    pub const TableHeaderCell: Self = Self(402);
371    #[doc(alias = "CGPDFTagTypeTableDataCell")]
372    pub const TableDataCell: Self = Self(403);
373    #[doc(alias = "CGPDFTagTypeTableHeader")]
374    pub const TableHeader: Self = Self(404);
375    #[doc(alias = "CGPDFTagTypeTableBody")]
376    pub const TableBody: Self = Self(405);
377    #[doc(alias = "CGPDFTagTypeTableFooter")]
378    pub const TableFooter: Self = Self(406);
379    #[doc(alias = "CGPDFTagTypeSpan")]
380    pub const Span: Self = Self(500);
381    #[doc(alias = "CGPDFTagTypeQuote")]
382    pub const Quote: Self = Self(501);
383    #[doc(alias = "CGPDFTagTypeNote")]
384    pub const Note: Self = Self(502);
385    #[doc(alias = "CGPDFTagTypeReference")]
386    pub const Reference: Self = Self(503);
387    #[doc(alias = "CGPDFTagTypeBibliography")]
388    pub const Bibliography: Self = Self(504);
389    #[doc(alias = "CGPDFTagTypeCode")]
390    pub const Code: Self = Self(505);
391    #[doc(alias = "CGPDFTagTypeLink")]
392    pub const Link: Self = Self(506);
393    #[doc(alias = "CGPDFTagTypeAnnotation")]
394    pub const Annotation: Self = Self(507);
395    #[doc(alias = "CGPDFTagTypeRuby")]
396    pub const Ruby: Self = Self(600);
397    #[doc(alias = "CGPDFTagTypeRubyBaseText")]
398    pub const RubyBaseText: Self = Self(601);
399    #[doc(alias = "CGPDFTagTypeRubyAnnotationText")]
400    pub const RubyAnnotationText: Self = Self(602);
401    #[doc(alias = "CGPDFTagTypeRubyPunctuation")]
402    pub const RubyPunctuation: Self = Self(603);
403    #[doc(alias = "CGPDFTagTypeWarichu")]
404    pub const Warichu: Self = Self(604);
405    #[doc(alias = "CGPDFTagTypeWarichuText")]
406    pub const WarichuText: Self = Self(605);
407    #[doc(alias = "CGPDFTagTypeWarichuPunctiation")]
408    pub const WarichuPunctiation: Self = Self(606);
409    #[doc(alias = "CGPDFTagTypeFigure")]
410    pub const Figure: Self = Self(700);
411    #[doc(alias = "CGPDFTagTypeFormula")]
412    pub const Formula: Self = Self(701);
413    #[doc(alias = "CGPDFTagTypeForm")]
414    pub const Form: Self = Self(702);
415    #[doc(alias = "CGPDFTagTypeObject")]
416    pub const Object: Self = Self(800);
417}
418
419#[cfg(feature = "objc2")]
420unsafe impl Encode for CGPDFTagType {
421    const ENCODING: Encoding = i32::ENCODING;
422}
423
424#[cfg(feature = "objc2")]
425unsafe impl RefEncode for CGPDFTagType {
426    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
427}
428
429impl CGPDFTagType {
430    #[doc(alias = "CGPDFTagTypeGetName")]
431    #[inline]
432    pub fn name(self) -> *const c_char {
433        extern "C-unwind" {
434            fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char;
435        }
436        unsafe { CGPDFTagTypeGetName(self) }
437    }
438}
439
440/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdftagproperty?language=objc)
441// NS_TYPED_ENUM
442pub type CGPDFTagProperty = CFString;
443
444extern "C" {
445    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertyactualtext?language=objc)
446    pub static kCGPDFTagPropertyActualText: &'static CGPDFTagProperty;
447}
448
449extern "C" {
450    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertyalternativetext?language=objc)
451    pub static kCGPDFTagPropertyAlternativeText: &'static CGPDFTagProperty;
452}
453
454extern "C" {
455    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertytitletext?language=objc)
456    pub static kCGPDFTagPropertyTitleText: &'static CGPDFTagProperty;
457}
458
459extern "C" {
460    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertylanguagetext?language=objc)
461    pub static kCGPDFTagPropertyLanguageText: &'static CGPDFTagProperty;
462}
463
464extern "C-unwind" {
465    /// # Safety
466    ///
467    /// `tag_properties` generics must be of the correct type.
468    #[cfg(feature = "CGContext")]
469    pub fn CGPDFContextBeginTag(
470        context: &CGContext,
471        tag_type: CGPDFTagType,
472        tag_properties: Option<&CFDictionary>,
473    );
474}
475
476#[cfg(feature = "CGContext")]
477#[inline]
478pub extern "C-unwind" fn CGPDFContextEndTag(context: &CGContext) {
479    extern "C-unwind" {
480        fn CGPDFContextEndTag(context: &CGContext);
481    }
482    unsafe { CGPDFContextEndTag(context) }
483}
484
485#[deprecated = "renamed to `CGPDFTagType::name`"]
486#[inline]
487pub extern "C-unwind" fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char {
488    extern "C-unwind" {
489        fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char;
490    }
491    unsafe { CGPDFTagTypeGetName(tag_type) }
492}