objc2_core_graphics/generated/
CGPDFContentStream.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#[repr(C)]
15#[derive(Debug)]
16pub struct CGPDFContentStream {
17 inner: [u8; 0],
18 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
19}
20
21#[cfg(feature = "objc2")]
22unsafe impl RefEncode for CGPDFContentStream {
23 const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("CGPDFContentStream", &[]));
24}
25
26pub type CGPDFContentStreamRef = *mut CGPDFContentStream;
28
29impl CGPDFContentStream {
30 #[doc(alias = "CGPDFContentStreamCreateWithPage")]
31 #[cfg(feature = "CGPDFPage")]
32 #[inline]
33 pub fn create_with_page(page: &CGPDFPage) -> CGPDFContentStreamRef {
34 extern "C-unwind" {
35 fn CGPDFContentStreamCreateWithPage(page: &CGPDFPage) -> CGPDFContentStreamRef;
36 }
37 unsafe { CGPDFContentStreamCreateWithPage(page) }
38 }
39
40 #[doc(alias = "CGPDFContentStreamCreateWithStream")]
46 #[cfg(all(feature = "CGPDFDictionary", feature = "CGPDFStream"))]
47 #[inline]
48 pub unsafe fn create_with_stream(
49 stream: CGPDFStreamRef,
50 stream_resources: CGPDFDictionaryRef,
51 parent: CGPDFContentStreamRef,
52 ) -> CGPDFContentStreamRef {
53 extern "C-unwind" {
54 fn CGPDFContentStreamCreateWithStream(
55 stream: CGPDFStreamRef,
56 stream_resources: CGPDFDictionaryRef,
57 parent: CGPDFContentStreamRef,
58 ) -> CGPDFContentStreamRef;
59 }
60 unsafe { CGPDFContentStreamCreateWithStream(stream, stream_resources, parent) }
61 }
62
63 #[doc(alias = "CGPDFContentStreamRetain")]
67 #[inline]
68 pub unsafe fn retain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef {
69 extern "C-unwind" {
70 fn CGPDFContentStreamRetain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef;
71 }
72 unsafe { CGPDFContentStreamRetain(cs) }
73 }
74
75 #[doc(alias = "CGPDFContentStreamRelease")]
79 #[inline]
80 pub unsafe fn release(cs: CGPDFContentStreamRef) {
81 extern "C-unwind" {
82 fn CGPDFContentStreamRelease(cs: CGPDFContentStreamRef);
83 }
84 unsafe { CGPDFContentStreamRelease(cs) }
85 }
86
87 #[doc(alias = "CGPDFContentStreamGetStreams")]
91 #[inline]
92 pub unsafe fn streams(cs: CGPDFContentStreamRef) -> Option<CFRetained<CFArray>> {
93 extern "C-unwind" {
94 fn CGPDFContentStreamGetStreams(cs: CGPDFContentStreamRef) -> Option<NonNull<CFArray>>;
95 }
96 let ret = unsafe { CGPDFContentStreamGetStreams(cs) };
97 ret.map(|ret| unsafe { CFRetained::retain(ret) })
98 }
99
100 #[doc(alias = "CGPDFContentStreamGetResource")]
106 #[cfg(feature = "CGPDFObject")]
107 #[inline]
108 pub unsafe fn resource(
109 cs: CGPDFContentStreamRef,
110 category: NonNull<c_char>,
111 name: NonNull<c_char>,
112 ) -> CGPDFObjectRef {
113 extern "C-unwind" {
114 fn CGPDFContentStreamGetResource(
115 cs: CGPDFContentStreamRef,
116 category: NonNull<c_char>,
117 name: NonNull<c_char>,
118 ) -> CGPDFObjectRef;
119 }
120 unsafe { CGPDFContentStreamGetResource(cs, category, name) }
121 }
122}
123
124#[cfg(feature = "CGPDFPage")]
125#[deprecated = "renamed to `CGPDFContentStream::create_with_page`"]
126#[inline]
127pub extern "C-unwind" fn CGPDFContentStreamCreateWithPage(
128 page: &CGPDFPage,
129) -> CGPDFContentStreamRef {
130 extern "C-unwind" {
131 fn CGPDFContentStreamCreateWithPage(page: &CGPDFPage) -> CGPDFContentStreamRef;
132 }
133 unsafe { CGPDFContentStreamCreateWithPage(page) }
134}
135
136extern "C-unwind" {
137 #[cfg(all(feature = "CGPDFDictionary", feature = "CGPDFStream"))]
138 #[deprecated = "renamed to `CGPDFContentStream::create_with_stream`"]
139 pub fn CGPDFContentStreamCreateWithStream(
140 stream: CGPDFStreamRef,
141 stream_resources: CGPDFDictionaryRef,
142 parent: CGPDFContentStreamRef,
143 ) -> CGPDFContentStreamRef;
144}
145
146extern "C-unwind" {
147 #[deprecated = "renamed to `CGPDFContentStream::retain`"]
148 pub fn CGPDFContentStreamRetain(cs: CGPDFContentStreamRef) -> CGPDFContentStreamRef;
149}
150
151extern "C-unwind" {
152 #[deprecated = "renamed to `CGPDFContentStream::release`"]
153 pub fn CGPDFContentStreamRelease(cs: CGPDFContentStreamRef);
154}
155
156#[deprecated = "renamed to `CGPDFContentStream::streams`"]
157#[inline]
158pub unsafe extern "C-unwind" fn CGPDFContentStreamGetStreams(
159 cs: CGPDFContentStreamRef,
160) -> Option<CFRetained<CFArray>> {
161 extern "C-unwind" {
162 fn CGPDFContentStreamGetStreams(cs: CGPDFContentStreamRef) -> Option<NonNull<CFArray>>;
163 }
164 let ret = unsafe { CGPDFContentStreamGetStreams(cs) };
165 ret.map(|ret| unsafe { CFRetained::retain(ret) })
166}
167
168extern "C-unwind" {
169 #[cfg(feature = "CGPDFObject")]
170 #[deprecated = "renamed to `CGPDFContentStream::resource`"]
171 pub fn CGPDFContentStreamGetResource(
172 cs: CGPDFContentStreamRef,
173 category: NonNull<c_char>,
174 name: NonNull<c_char>,
175 ) -> CGPDFObjectRef;
176}