1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
/// The UTType for storing drawing data.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkappledrawingtypeidentifier?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static PKAppleDrawingTypeIdentifier: &'static CFString;
}
extern_class!(
/// The data model object for storing drawing data created from PKCanvasView.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkdrawing?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PKDrawing;
);
unsafe impl Send for PKDrawing {}
unsafe impl Sync for PKDrawing {}
extern_conformance!(
unsafe impl NSCoding for PKDrawing {}
);
extern_conformance!(
unsafe impl NSCopying for PKDrawing {}
);
unsafe impl CopyingHelper for PKDrawing {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for PKDrawing {}
);
extern_conformance!(
unsafe impl NSSecureCoding for PKDrawing {}
);
impl PKDrawing {
extern_methods!(
/// Initializes and returns a blank drawing.
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "PKStroke")]
/// Initializes a drawing with an array of strokes.
#[unsafe(method(initWithStrokes:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithStrokes(
this: Allocated<Self>,
strokes: &NSArray<PKStroke>,
) -> Retained<Self>;
/// Initializes and returns the drawing with the specified data.
///
///
/// Parameter `data`: The data containing the drawing data.
///
/// Parameter `error`: If an error occurs, upon return the NSError object describes the error.
/// Set to NULL to ignore errors.
///
/// Returns: On success, an initialized PKDrawing object. If nil, the outError parameter
/// contains an NSError instance describing the problem.
#[unsafe(method(initWithData:error:_))]
#[unsafe(method_family = init)]
pub unsafe fn initWithData_error(
this: Allocated<Self>,
data: &NSData,
) -> Result<Retained<Self>, Retained<NSError>>;
/// Generate a data representation of the drawing.
///
///
/// Returns: A NSData object containing a representation of the drawing.
#[unsafe(method(dataRepresentation))]
#[unsafe(method_family = none)]
pub unsafe fn dataRepresentation(&self) -> Retained<NSData>;
#[cfg(feature = "PKStroke")]
/// The strokes that this drawing contains.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(strokes))]
#[unsafe(method_family = none)]
pub unsafe fn strokes(&self) -> Retained<NSArray<PKStroke>>;
#[cfg(feature = "objc2-core-foundation")]
/// The bounds of the drawing's contents, taking into account the rendered width of all content.
/// If these bounds are used to render an image with `imageFromRect:scale:`, no contents will be cropped.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(bounds))]
#[unsafe(method_family = none)]
pub unsafe fn bounds(&self) -> CGRect;
#[cfg(feature = "PKContentVersion")]
/// The PencilKit version required to use this drawing.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(requiredContentVersion))]
#[unsafe(method_family = none)]
pub unsafe fn requiredContentVersion(&self) -> PKContentVersion;
#[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
#[cfg(target_os = "macos")]
#[unsafe(method(imageFromRect:scale:))]
#[unsafe(method_family = none)]
pub unsafe fn imageFromRect_scale(&self, rect: CGRect, scale: CGFloat)
-> Retained<NSImage>;
#[cfg(feature = "objc2-core-foundation")]
/// Returns a new drawing with `transform` applied.
///
///
/// Parameter `transform`: The transform to apply to this drawing.
///
/// Returns: A new copy of this drawing with `transform` applied.
#[unsafe(method(drawingByApplyingTransform:))]
#[unsafe(method_family = none)]
pub unsafe fn drawingByApplyingTransform(
&self,
transform: CGAffineTransform,
) -> Retained<PKDrawing>;
/// Returns a new drawing by appending the contents of `drawing` on top of the receiver’s contents.
///
///
/// Parameter `drawing`: The drawing to append.
///
/// Returns: A new copy of this drawing with `drawing` appended onto it.
#[unsafe(method(drawingByAppendingDrawing:))]
#[unsafe(method_family = none)]
pub unsafe fn drawingByAppendingDrawing(&self, drawing: &PKDrawing) -> Retained<PKDrawing>;
#[cfg(feature = "PKStroke")]
/// Create a new drawing by appending an array of strokes to this drawing.
/// This is a convenience method, to quickly add strokes to a drawing.
///
///
/// Parameter `strokes`: The strokes to append.
///
/// Returns: A new copy of this drawing with `strokes` appended onto it.
#[unsafe(method(drawingByAppendingStrokes:))]
#[unsafe(method_family = none)]
pub unsafe fn drawingByAppendingStrokes(
&self,
strokes: &NSArray<PKStroke>,
) -> Retained<PKDrawing>;
);
}
/// Methods declared on superclass `NSObject`.
impl PKDrawing {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}