objc2_ui_kit/generated/
UIGraphics.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
15#[inline]
16pub extern "C-unwind" fn UIGraphicsGetCurrentContext() -> Option<CFRetained<CGContext>> {
17    extern "C-unwind" {
18        fn UIGraphicsGetCurrentContext() -> Option<NonNull<CGContext>>;
19    }
20    let ret = unsafe { UIGraphicsGetCurrentContext() };
21    ret.map(|ret| unsafe { CFRetained::retain(ret) })
22}
23
24extern "C-unwind" {
25    #[cfg(feature = "objc2-core-graphics")]
26    pub fn UIGraphicsPushContext(context: &CGContext);
27}
28
29extern "C-unwind" {
30    pub fn UIGraphicsPopContext();
31}
32
33#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
34#[inline]
35pub extern "C-unwind" fn UIRectFillUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode) {
36    extern "C-unwind" {
37        fn UIRectFillUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode);
38    }
39    unsafe { UIRectFillUsingBlendMode(rect, blend_mode) }
40}
41
42#[cfg(feature = "objc2-core-foundation")]
43#[inline]
44pub extern "C-unwind" fn UIRectFill(rect: CGRect) {
45    extern "C-unwind" {
46        fn UIRectFill(rect: CGRect);
47    }
48    unsafe { UIRectFill(rect) }
49}
50
51#[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
52#[inline]
53pub extern "C-unwind" fn UIRectFrameUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode) {
54    extern "C-unwind" {
55        fn UIRectFrameUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode);
56    }
57    unsafe { UIRectFrameUsingBlendMode(rect, blend_mode) }
58}
59
60#[cfg(feature = "objc2-core-foundation")]
61#[inline]
62pub extern "C-unwind" fn UIRectFrame(rect: CGRect) {
63    extern "C-unwind" {
64        fn UIRectFrame(rect: CGRect);
65    }
66    unsafe { UIRectFrame(rect) }
67}
68
69#[cfg(feature = "objc2-core-foundation")]
70#[inline]
71pub extern "C-unwind" fn UIRectClip(rect: CGRect) {
72    extern "C-unwind" {
73        fn UIRectClip(rect: CGRect);
74    }
75    unsafe { UIRectClip(rect) }
76}
77
78#[cfg(feature = "objc2-core-foundation")]
79#[deprecated = "Replace usage of UIGraphicsBeginImageContext with UIGraphicsImageRenderer."]
80#[inline]
81pub extern "C-unwind" fn UIGraphicsBeginImageContext(size: CGSize) {
82    extern "C-unwind" {
83        fn UIGraphicsBeginImageContext(size: CGSize);
84    }
85    unsafe { UIGraphicsBeginImageContext(size) }
86}
87
88#[cfg(feature = "objc2-core-foundation")]
89#[deprecated = "Replace usage of UIGraphicsBeginImageContextWithOptions with UIGraphicsImageRenderer."]
90#[inline]
91pub extern "C-unwind" fn UIGraphicsBeginImageContextWithOptions(
92    size: CGSize,
93    opaque: bool,
94    scale: CGFloat,
95) {
96    extern "C-unwind" {
97        fn UIGraphicsBeginImageContextWithOptions(size: CGSize, opaque: Bool, scale: CGFloat);
98    }
99    unsafe { UIGraphicsBeginImageContextWithOptions(size, Bool::new(opaque), scale) }
100}
101
102#[cfg(feature = "UIImage")]
103#[deprecated = "Replace usage of UIGraphicsGetImageFromCurrentImageContext with UIGraphicsImageRendererContext.currentImage."]
104#[inline]
105pub extern "C-unwind" fn UIGraphicsGetImageFromCurrentImageContext() -> Option<Retained<UIImage>> {
106    extern "C-unwind" {
107        fn UIGraphicsGetImageFromCurrentImageContext() -> *mut UIImage;
108    }
109    let ret = unsafe { UIGraphicsGetImageFromCurrentImageContext() };
110    unsafe { Retained::retain_autoreleased(ret) }
111}
112
113#[deprecated = "UIGraphicsEndImageContext should only be used alongside UIGraphicsBeginImageContext[WithOptions]."]
114#[inline]
115pub extern "C-unwind" fn UIGraphicsEndImageContext() {
116    extern "C-unwind" {
117        fn UIGraphicsEndImageContext();
118    }
119    unsafe { UIGraphicsEndImageContext() }
120}
121
122/// # Safety
123///
124/// `document_info` generic should be of the correct type.
125#[cfg(feature = "objc2-core-foundation")]
126#[inline]
127pub unsafe extern "C-unwind" fn UIGraphicsBeginPDFContextToFile(
128    path: &NSString,
129    bounds: CGRect,
130    document_info: Option<&NSDictionary>,
131) -> bool {
132    extern "C-unwind" {
133        fn UIGraphicsBeginPDFContextToFile(
134            path: &NSString,
135            bounds: CGRect,
136            document_info: Option<&NSDictionary>,
137        ) -> Bool;
138    }
139    unsafe { UIGraphicsBeginPDFContextToFile(path, bounds, document_info) }.as_bool()
140}
141
142extern "C-unwind" {
143    /// # Safety
144    ///
145    /// `document_info` generic should be of the correct type.
146    #[cfg(feature = "objc2-core-foundation")]
147    pub fn UIGraphicsBeginPDFContextToData(
148        data: &NSMutableData,
149        bounds: CGRect,
150        document_info: Option<&NSDictionary>,
151    );
152}
153
154#[inline]
155pub extern "C-unwind" fn UIGraphicsEndPDFContext() {
156    extern "C-unwind" {
157        fn UIGraphicsEndPDFContext();
158    }
159    unsafe { UIGraphicsEndPDFContext() }
160}
161
162#[inline]
163pub extern "C-unwind" fn UIGraphicsBeginPDFPage() {
164    extern "C-unwind" {
165        fn UIGraphicsBeginPDFPage();
166    }
167    unsafe { UIGraphicsBeginPDFPage() }
168}
169
170extern "C-unwind" {
171    /// # Safety
172    ///
173    /// `page_info` generic should be of the correct type.
174    #[cfg(feature = "objc2-core-foundation")]
175    pub fn UIGraphicsBeginPDFPageWithInfo(bounds: CGRect, page_info: Option<&NSDictionary>);
176}
177
178#[cfg(feature = "objc2-core-foundation")]
179#[inline]
180pub extern "C-unwind" fn UIGraphicsGetPDFContextBounds() -> CGRect {
181    extern "C-unwind" {
182        fn UIGraphicsGetPDFContextBounds() -> CGRect;
183    }
184    unsafe { UIGraphicsGetPDFContextBounds() }
185}
186
187#[cfg(feature = "objc2-core-foundation")]
188#[inline]
189pub extern "C-unwind" fn UIGraphicsSetPDFContextURLForRect(url: &NSURL, rect: CGRect) {
190    extern "C-unwind" {
191        fn UIGraphicsSetPDFContextURLForRect(url: &NSURL, rect: CGRect);
192    }
193    unsafe { UIGraphicsSetPDFContextURLForRect(url, rect) }
194}
195
196#[cfg(feature = "objc2-core-foundation")]
197#[inline]
198pub extern "C-unwind" fn UIGraphicsAddPDFContextDestinationAtPoint(
199    name: &NSString,
200    point: CGPoint,
201) {
202    extern "C-unwind" {
203        fn UIGraphicsAddPDFContextDestinationAtPoint(name: &NSString, point: CGPoint);
204    }
205    unsafe { UIGraphicsAddPDFContextDestinationAtPoint(name, point) }
206}
207
208#[cfg(feature = "objc2-core-foundation")]
209#[inline]
210pub extern "C-unwind" fn UIGraphicsSetPDFContextDestinationForRect(name: &NSString, rect: CGRect) {
211    extern "C-unwind" {
212        fn UIGraphicsSetPDFContextDestinationForRect(name: &NSString, rect: CGRect);
213    }
214    unsafe { UIGraphicsSetPDFContextDestinationForRect(name, rect) }
215}