@@ -100,13 +100,13 @@ impl Path {
100
100
101
101
#[ doc( alias = "CGPathCreateCopyByTransformingPath" ) ]
102
102
#[ inline]
103
- pub fn copy_transforming_path ( & self , transform : Option < & cg:: AffineTransform > ) -> arc:: R < Self > {
103
+ pub fn transforming_path ( & self , transform : Option < & cg:: AffineTransform > ) -> arc:: R < Self > {
104
104
unsafe { CGPathCreateCopyByTransformingPath ( self , transform) }
105
105
}
106
106
107
107
#[ doc( alias = "CGPathCreateMutableCopyByTransformingPath" ) ]
108
108
#[ inline]
109
- pub fn copy_mut_transforming_path (
109
+ pub fn transforming_path_mut (
110
110
& self ,
111
111
transform : Option < & cg:: AffineTransform > ,
112
112
) -> arc:: R < PathMut > {
@@ -115,7 +115,7 @@ impl Path {
115
115
116
116
#[ doc( alias = "CGPathCreateCopyByDashingPath" ) ]
117
117
#[ inline]
118
- pub fn copy_dashing_path (
118
+ pub fn dashing_path (
119
119
& self ,
120
120
transform : Option < & cg:: AffineTransform > ,
121
121
phase : cg:: Float ,
@@ -128,7 +128,7 @@ impl Path {
128
128
129
129
#[ doc( alias = "CGPathCreateCopyByStrokingPath" ) ]
130
130
#[ inline]
131
- pub fn copy_stroking_path (
131
+ pub fn stroking_path (
132
132
& self ,
133
133
transform : Option < & cg:: AffineTransform > ,
134
134
line_width : cg:: Float ,
@@ -203,13 +203,14 @@ impl Path {
203
203
pub fn bounding_box ( & self ) -> cg:: Rect {
204
204
unsafe { CGPathGetBoundingBox ( self ) }
205
205
}
206
-
206
+
207
207
#[ doc( alias = "CGPathGetPathBoundingBox" ) ]
208
208
#[ inline]
209
209
pub fn path_bounding_box ( & self ) -> cg:: Rect {
210
210
unsafe { CGPathGetPathBoundingBox ( self ) }
211
211
}
212
212
213
+ #[ doc( alias = "CGPathContainsPoint" ) ]
213
214
#[ inline]
214
215
pub fn contains_point (
215
216
& self ,
@@ -237,13 +238,20 @@ impl Path {
237
238
unsafe { CGPathApplyWithBlock ( self , block) }
238
239
}
239
240
241
+ #[ cfg( feature = "blocks" ) ]
242
+ #[ inline]
243
+ pub fn apply_mut ( & self , mut f : impl FnMut ( & cg:: PathElement ) ) {
244
+ let mut block = unsafe { ApplyBlock :: stack1 ( & mut f) } ;
245
+ self . apply_block ( & mut block) ;
246
+ }
247
+
240
248
#[ inline]
241
- pub fn copy_normalizing ( & self , even_odd_fill_rule : bool ) -> arc:: R < Self > {
249
+ pub fn normalizing ( & self , even_odd_fill_rule : bool ) -> arc:: R < Self > {
242
250
unsafe { CGPathCreateCopyByNormalizing ( self , even_odd_fill_rule) }
243
251
}
244
252
245
253
#[ inline]
246
- pub fn copy_unioning_path (
254
+ pub fn unioning_path (
247
255
& self ,
248
256
mask_path : Option < & Path > ,
249
257
even_odd_fill_rule : bool ,
@@ -252,7 +260,7 @@ impl Path {
252
260
}
253
261
254
262
#[ inline]
255
- pub fn copy_intersecting_path (
263
+ pub fn intersecting_path (
256
264
& self ,
257
265
mask_path : Option < & Path > ,
258
266
even_odd_fill_rule : bool ,
@@ -261,7 +269,7 @@ impl Path {
261
269
}
262
270
263
271
#[ inline]
264
- pub fn copy_subtructing_path (
272
+ pub fn subtructing_path (
265
273
& self ,
266
274
mask_path : Option < & Path > ,
267
275
even_odd_fill_rule : bool ,
@@ -270,7 +278,7 @@ impl Path {
270
278
}
271
279
272
280
#[ inline]
273
- pub fn copy_symmetric_diff_of_path (
281
+ pub fn symmetric_diff_of_path (
274
282
& self ,
275
283
mask_path : Option < & Path > ,
276
284
even_odd_fill_rule : bool ,
@@ -279,15 +287,15 @@ impl Path {
279
287
}
280
288
281
289
#[ inline]
282
- pub fn copy_line_by_substructing_path (
290
+ pub fn line_by_substructing_path (
283
291
& self ,
284
292
mask_path : Option < & Path > ,
285
293
even_odd_fill_rule : bool ,
286
294
) -> arc:: R < Self > {
287
295
unsafe { CGPathCreateCopyOfLineBySubtractingPath ( self , mask_path, even_odd_fill_rule) }
288
296
}
289
297
#[ inline]
290
- pub fn copy_line_by_intersecting_path (
298
+ pub fn line_by_intersecting_path (
291
299
& self ,
292
300
mask_path : Option < & Path > ,
293
301
even_odd_fill_rule : bool ,
@@ -301,7 +309,7 @@ impl Path {
301
309
}
302
310
303
311
#[ inline]
304
- pub fn copy_flattering ( & self , flattening_threshold : cg:: Float ) -> arc:: R < Self > {
312
+ pub fn flattering ( & self , flattening_threshold : cg:: Float ) -> arc:: R < Self > {
305
313
unsafe { CGPathCreateCopyByFlattening ( self , flattening_threshold) }
306
314
}
307
315
@@ -312,17 +320,20 @@ impl Path {
312
320
}
313
321
314
322
impl PartialEq for Path {
323
+ #[ inline]
315
324
fn eq ( & self , other : & Self ) -> bool {
316
325
self . equal ( other)
317
326
}
318
327
}
319
328
320
329
define_cf_type ! ( PathMut ( Path ) ) ;
321
330
impl PathMut {
331
+ #[ inline]
322
332
pub fn new ( ) -> arc:: R < Self > {
323
333
unsafe { CGPathCreateMutable ( ) }
324
334
}
325
335
336
+ #[ inline]
326
337
pub fn add_rounded_rect (
327
338
& mut self ,
328
339
transform : Option < & cg:: AffineTransform > ,
@@ -740,7 +751,7 @@ mod tests {
740
751
let path = cg:: Path :: with_ellipse_in_rect ( cg:: Rect :: zero ( ) , None ) ;
741
752
path. show ( ) ;
742
753
743
- let path = path. copy_stroking_path (
754
+ let path = path. stroking_path (
744
755
None ,
745
756
5.0f64 ,
746
757
cg:: LineCap :: Round ,
@@ -765,5 +776,11 @@ mod tests {
765
776
path. curve_to ( 10 , 20 , 30 , -40 , 10 , 20 ) ;
766
777
path. close_subpath ( ) ;
767
778
path. show ( ) ;
779
+
780
+ elements. clear ( ) ;
781
+ path. apply_mut ( |element| {
782
+ elements. push ( element. type_ ) ;
783
+ } ) ;
784
+ assert ! ( !elements. is_empty( ) ) ;
768
785
}
769
786
}
0 commit comments