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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A uniform cubic B-spline representing the point data of a `PKStroke`.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkstrokepath?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct PKStrokePath;
);
unsafe impl Send for PKStrokePath {}
unsafe impl Sync for PKStrokePath {}
extern_conformance!(
unsafe impl NSCopying for PKStrokePath {}
);
unsafe impl CopyingHelper for PKStrokePath {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for PKStrokePath {}
);
impl PKStrokePath {
extern_methods!(
#[cfg(feature = "PKStrokePoint")]
/// Create a stroke path value with the given cubic B-spline control points.
///
///
/// Parameter `controlPoints`: An array of control points for a cubic B-spline.
///
/// Parameter `creationDate`: The start time of this path.
#[unsafe(method(initWithControlPoints:creationDate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithControlPoints_creationDate(
this: Allocated<Self>,
control_points: &NSArray<PKStrokePoint>,
creation_date: &NSDate,
) -> Retained<Self>;
/// The number of control points in this stroke path.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(count))]
#[unsafe(method_family = none)]
pub unsafe fn count(&self) -> NSUInteger;
/// The time at which this stroke path was started.
/// The `timeOffset` of contained PKStrokePoints is relative to this date.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(creationDate))]
#[unsafe(method_family = none)]
pub unsafe fn creationDate(&self) -> Retained<NSDate>;
#[cfg(feature = "PKStrokePoint")]
/// Returns B-spline control point at index `i`.
#[unsafe(method(pointAtIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn pointAtIndex(&self, i: NSUInteger) -> Retained<PKStrokePoint>;
#[cfg(feature = "PKStrokePoint")]
/// Returns B-spline control point at index `i`.
#[unsafe(method(objectAtIndexedSubscript:))]
#[unsafe(method_family = none)]
pub unsafe fn objectAtIndexedSubscript(&self, i: NSUInteger) -> Retained<PKStrokePoint>;
#[cfg(feature = "objc2-core-foundation")]
/// The on-curve location for the floating point [0, count-1] `parametricValue` parameter.
///
/// This has better performance than `[self interpolatedPointAt: parametricValue].location`
/// for when only the location is required.
#[unsafe(method(interpolatedLocationAt:))]
#[unsafe(method_family = none)]
pub unsafe fn interpolatedLocationAt(&self, parametric_value: CGFloat) -> CGPoint;
#[cfg(all(feature = "PKStrokePoint", feature = "objc2-core-foundation"))]
/// The on-curve point for the floating point [0, count-1] `parametricValue` parameter.
#[unsafe(method(interpolatedPointAt:))]
#[unsafe(method_family = none)]
pub unsafe fn interpolatedPointAt(
&self,
parametric_value: CGFloat,
) -> Retained<PKStrokePoint>;
#[cfg(all(
feature = "PKFloatRange",
feature = "PKStrokePoint",
feature = "block2",
feature = "objc2-core-foundation"
))]
/// Executes a given block using each point in a range with a distance step.
///
///
/// Parameter `range`: The parametric range to enumerate points in.
///
/// Parameter `distanceStep`: The distance to step between points.
///
/// Parameter `block`: The block to execute for each point. This block takes two parameters
/// point The interpolated point on the spline.
/// stop A reference to a Boolean value. Setting the value to YES within the block stops further enumeration of the array. If a block stops further enumeration, that block continues to run until it’s finished.
#[unsafe(method(enumerateInterpolatedPointsInRange:strideByDistance:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateInterpolatedPointsInRange_strideByDistance_usingBlock(
&self,
range: &PKFloatRange,
distance_step: CGFloat,
block: &block2::DynBlock<dyn Fn(NonNull<PKStrokePoint>, NonNull<Bool>)>,
);
#[cfg(all(
feature = "PKFloatRange",
feature = "PKStrokePoint",
feature = "block2"
))]
/// Executes a given block using each point in a range with a time step.
///
///
/// Parameter `range`: The parametric range to enumerate points in.
///
/// Parameter `timeStep`: The time interval to step between points.
///
/// Parameter `block`: The block to execute for each point. This block takes two parameters
/// point The interpolated point on the spline.
/// stop A reference to a Boolean value. Setting the value to YES within the block stops further enumeration of the array. If a block stops further enumeration, that block continues to run until it’s finished.
#[unsafe(method(enumerateInterpolatedPointsInRange:strideByTime:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateInterpolatedPointsInRange_strideByTime_usingBlock(
&self,
range: &PKFloatRange,
time_step: NSTimeInterval,
block: &block2::DynBlock<dyn Fn(NonNull<PKStrokePoint>, NonNull<Bool>)>,
);
#[cfg(all(
feature = "PKFloatRange",
feature = "PKStrokePoint",
feature = "block2",
feature = "objc2-core-foundation"
))]
/// Executes a given block using each point in a range with a parametric step.
///
///
/// Parameter `range`: The parametric range to enumerate points in.
///
/// Parameter `parametricStep`: The parametric step between points.
///
/// Parameter `block`: The block to execute for each point. This block takes two parameters
/// point The interpolated point on the spline.
/// stop A reference to a Boolean value. Setting the value to YES within the block stops further enumeration of the array. If a block stops further enumeration, that block continues to run until it’s finished.
#[unsafe(method(enumerateInterpolatedPointsInRange:strideByParametricStep:usingBlock:))]
#[unsafe(method_family = none)]
pub unsafe fn enumerateInterpolatedPointsInRange_strideByParametricStep_usingBlock(
&self,
range: &PKFloatRange,
parametric_step: CGFloat,
block: &block2::DynBlock<dyn Fn(NonNull<PKStrokePoint>, NonNull<Bool>)>,
);
#[cfg(feature = "objc2-core-foundation")]
/// Returns a parametric value on the B-spline that is a specified distance from the given parametric value.
///
///
/// Parameter `parametricValue`: The floating point [0, count-1] parametric value.
///
/// Parameter `distanceStep`: The distance to offset `parametricValue`. `distanceStep` can be positive or negative.
///
/// Returns: A parametric value offset by `distanceStep` from `parametricValue`.
#[unsafe(method(parametricValue:offsetByDistance:))]
#[unsafe(method_family = none)]
pub unsafe fn parametricValue_offsetByDistance(
&self,
parametric_value: CGFloat,
distance_step: CGFloat,
) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
/// Returns a parametric value on the B-spline that is a specified time from the given parametric value.
///
///
/// Parameter `parametricValue`: The floating point [0, count-1] parametric value.
///
/// Parameter `timeStep`: The time to offset `parametricValue`. `timeStep` can be positive or negative.
///
/// Returns: A parametric value offset by `timeStep` from `parametricValue`.
#[unsafe(method(parametricValue:offsetByTime:))]
#[unsafe(method_family = none)]
pub unsafe fn parametricValue_offsetByTime(
&self,
parametric_value: CGFloat,
time_step: NSTimeInterval,
) -> CGFloat;
);
}
/// Methods declared on superclass `NSObject`.
impl PKStrokePath {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}