@@ -229,16 +229,32 @@ public struct Path {
229229
230230 public init ( ) { }
231231
232+ /// Move the path's current point to the given point.
233+ ///
234+ /// This does not draw a line segment. For that, see ``addLine(to:)``.
235+ ///
236+ /// If ``addLine(to:)``, ``addQuadCurve(control:to:)``,
237+ /// ``addCubicCurve(control1:control2:to:)``, or
238+ /// ``addArc(center:radius:startAngle:endAngle:clockwise:)`` is called on an empty path
239+ /// without calling this method first, the start point is implicitly (0, 0).
232240 public consuming func move( to point: SIMD2 < Double > ) -> Path {
233241 actions. append ( . moveTo( point) )
234242 return self
235243 }
236244
245+ /// Add a line segment from the current point to the given point.
246+ ///
247+ /// After this, the path's current point will be the endpoint of this line segment.
237248 public consuming func addLine( to point: SIMD2 < Double > ) -> Path {
238249 actions. append ( . lineTo( point) )
239250 return self
240251 }
241252
253+ /// Add a quadratic Bézier curve to the path.
254+ ///
255+ /// This creates an order-2 curve starting at the path's current point, bending towards
256+ /// `control`, and ending at `endPoint`. After this, the path's current point will be
257+ /// `endPoint`.
242258 public consuming func addQuadCurve(
243259 control: SIMD2 < Double > ,
244260 to endPoint: SIMD2 < Double >
@@ -247,6 +263,11 @@ public struct Path {
247263 return self
248264 }
249265
266+ /// Add a cubic Bézier curve to the path.
267+ ///
268+ /// This creates an order-3 curve starting at the path's current point, bending towards
269+ /// `control1` and `control2`, and ending at `endPoint`. After this, the path's current
270+ /// point will be `endPoint`.
250271 public consuming func addCubicCurve(
251272 control1: SIMD2 < Double > ,
252273 control2: SIMD2 < Double > ,
@@ -267,6 +288,9 @@ public struct Path {
267288 }
268289
269290 /// Add an arc segment to the path.
291+ ///
292+ /// After this, the path's current point will be the endpoint implied by `center`, `radius`,
293+ /// and `endAngle`.
270294 /// - Parameters:
271295 /// - center: The location of the center of the circle.
272296 /// - radius: The radius of the circle.
@@ -297,11 +321,21 @@ public struct Path {
297321 return self
298322 }
299323
324+ /// Apply the given transform to the segments in the path so far.
325+ ///
326+ /// While this may adjust the path's current point, it does not otherwise affect segments
327+ /// that are added to the path after this method call.
300328 public consuming func applyTransform( _ transform: AffineTransform ) -> Path {
301329 actions. append ( . transform( transform) )
302330 return self
303331 }
304332
333+ /// Add the entirety of another path as part of this path.
334+ ///
335+ /// This can be necessary to section off transforms, as transforms applied to `subpath`
336+ /// will not affect this path.
337+ ///
338+ /// The fill rule and preferred stroke style of the subpath are ignored.
305339 public consuming func addSubpath( _ subpath: Path ) -> Path {
306340 actions. append ( . subpath( subpath. actions) )
307341 return self
@@ -316,6 +350,7 @@ public struct Path {
316350 return self
317351 }
318352
353+ /// Set the fill rule for the path.
319354 public consuming func fillRule( _ rule: FillRule ) -> Path {
320355 fillRule = rule
321356 return self
0 commit comments