objc2_ui_kit/generated/
UIGraphics.rs1use 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
14extern "C-unwind" {
15 #[cfg(feature = "objc2-core-graphics")]
16 pub fn UIGraphicsPushContext(context: &CGContext);
17}
18
19extern "C-unwind" {
20 pub fn UIGraphicsPopContext();
21}
22
23extern "C-unwind" {
24 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
25 pub fn UIRectFillUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode);
26}
27
28extern "C-unwind" {
29 #[cfg(feature = "objc2-core-foundation")]
30 pub fn UIRectFill(rect: CGRect);
31}
32
33extern "C-unwind" {
34 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-core-graphics"))]
35 pub fn UIRectFrameUsingBlendMode(rect: CGRect, blend_mode: CGBlendMode);
36}
37
38extern "C-unwind" {
39 #[cfg(feature = "objc2-core-foundation")]
40 pub fn UIRectFrame(rect: CGRect);
41}
42
43extern "C-unwind" {
44 #[cfg(feature = "objc2-core-foundation")]
45 pub fn UIRectClip(rect: CGRect);
46}
47
48extern "C-unwind" {
49 #[cfg(feature = "objc2-core-foundation")]
50 #[deprecated = "Replace usage of UIGraphicsBeginImageContext with UIGraphicsImageRenderer."]
51 pub fn UIGraphicsBeginImageContext(size: CGSize);
52}
53
54#[cfg(feature = "objc2-core-foundation")]
55#[deprecated = "Replace usage of UIGraphicsBeginImageContextWithOptions with UIGraphicsImageRenderer."]
56#[inline]
57pub unsafe extern "C-unwind" fn UIGraphicsBeginImageContextWithOptions(
58 size: CGSize,
59 opaque: bool,
60 scale: CGFloat,
61) {
62 extern "C-unwind" {
63 fn UIGraphicsBeginImageContextWithOptions(size: CGSize, opaque: Bool, scale: CGFloat);
64 }
65 unsafe { UIGraphicsBeginImageContextWithOptions(size, Bool::new(opaque), scale) }
66}
67
68#[cfg(feature = "UIImage")]
69#[deprecated = "Replace usage of UIGraphicsGetImageFromCurrentImageContext with UIGraphicsImageRendererContext.currentImage."]
70#[inline]
71pub unsafe extern "C-unwind" fn UIGraphicsGetImageFromCurrentImageContext(
72) -> Option<Retained<UIImage>> {
73 extern "C-unwind" {
74 fn UIGraphicsGetImageFromCurrentImageContext() -> *mut UIImage;
75 }
76 let ret = unsafe { UIGraphicsGetImageFromCurrentImageContext() };
77 unsafe { Retained::retain_autoreleased(ret) }
78}
79
80extern "C-unwind" {
81 #[deprecated = "UIGraphicsEndImageContext should only be used alongside UIGraphicsBeginImageContext[WithOptions]."]
82 pub fn UIGraphicsEndImageContext();
83}
84
85#[cfg(feature = "objc2-core-foundation")]
86#[inline]
87pub unsafe extern "C-unwind" fn UIGraphicsBeginPDFContextToFile(
88 path: &NSString,
89 bounds: CGRect,
90 document_info: Option<&NSDictionary>,
91) -> bool {
92 extern "C-unwind" {
93 fn UIGraphicsBeginPDFContextToFile(
94 path: &NSString,
95 bounds: CGRect,
96 document_info: Option<&NSDictionary>,
97 ) -> Bool;
98 }
99 unsafe { UIGraphicsBeginPDFContextToFile(path, bounds, document_info) }.as_bool()
100}
101
102extern "C-unwind" {
103 #[cfg(feature = "objc2-core-foundation")]
104 pub fn UIGraphicsBeginPDFContextToData(
105 data: &NSMutableData,
106 bounds: CGRect,
107 document_info: Option<&NSDictionary>,
108 );
109}
110
111extern "C-unwind" {
112 pub fn UIGraphicsEndPDFContext();
113}
114
115extern "C-unwind" {
116 pub fn UIGraphicsBeginPDFPage();
117}
118
119extern "C-unwind" {
120 #[cfg(feature = "objc2-core-foundation")]
121 pub fn UIGraphicsBeginPDFPageWithInfo(bounds: CGRect, page_info: Option<&NSDictionary>);
122}
123
124extern "C-unwind" {
125 #[cfg(feature = "objc2-core-foundation")]
126 pub fn UIGraphicsGetPDFContextBounds() -> CGRect;
127}
128
129extern "C-unwind" {
130 #[cfg(feature = "objc2-core-foundation")]
131 pub fn UIGraphicsSetPDFContextURLForRect(url: &NSURL, rect: CGRect);
132}
133
134extern "C-unwind" {
135 #[cfg(feature = "objc2-core-foundation")]
136 pub fn UIGraphicsAddPDFContextDestinationAtPoint(name: &NSString, point: CGPoint);
137}
138
139extern "C-unwind" {
140 #[cfg(feature = "objc2-core-foundation")]
141 pub fn UIGraphicsSetPDFContextDestinationForRect(name: &NSString, rect: CGRect);
142}