You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: engine/src/canvas.mlc
+47Lines changed: 47 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2675,6 +2675,7 @@ public foreign handler MCCanvasPathLineTo(in pPoint as Point, inout xPath as Pat
2675
2675
public foreign handler MCCanvasPathCurveThroughPoint(in pThrough as Point, in pTo as Point, inout xPath as Path) returns nothing binds to "<builtin>"
2676
2676
public foreign handler MCCanvasPathCurveThroughPoints(in pThroughA as Point, in pThroughB as Point, in pTo as Point, inout xPath as Path) returns nothing binds to "<builtin>"
2677
2677
2678
+
public foreign handler MCCanvasPathEllipticArcToWithRadiiAsList(in pTo as Point, in pRadii as List, in pRotation as CanvasFloat, inout xPath as Path) returns nothing binds to "<builtin>"
2678
2679
public foreign handler MCCanvasPathEllipticArcToWithFlagsWithRadiiAsList(in pTo as Point, in pRadii as List, in pRotation as CanvasFloat, in pLargest as bool, in pClockwise as bool, inout xPath as Path) returns nothing binds to "<builtin>"
2679
2680
2680
2681
public foreign handler MCCanvasPathClosePath(inout xPath as Path) returns nothing binds to "<builtin>"
@@ -2787,6 +2788,52 @@ begin
2787
2788
end syntax
2788
2789
2789
2790
2791
+
/*
2792
+
Summary: Adds an arc to a path.
2793
+
2794
+
mEnd: An expression which evaluates to a point.
2795
+
mRadii: An expression which evaluates to a list of numbers.
2796
+
mAngle: An expression which evaluates to a number.
2797
+
mPath: An expression which evaluates to a path.
2798
+
2799
+
Description: Adds an arc from the previous point to <mEnd> on <mPath>, following a section of an ellipse with the given radii & angle.
2800
+
As there can be two different ellipses that match the parameters, and two potential arcs for each ellipse, this variation of "arc to ..." will select the arc that most closely matches the direction from the last point to the current position on <mPath>.
2801
+
2802
+
Example:
2803
+
// Construct a path tracing out a rectangle with rounded bottom corners.
2804
+
variable tPath
2805
+
put the empty path into tPath
2806
+
2807
+
// Begin a new subpath
2808
+
move to point [0, 0] on tPath
2809
+
2810
+
// Trace the left edge
2811
+
line to point [0, my height - 25] on tPath
2812
+
2813
+
// Continue path with an arc to the bottom edge
2814
+
arc to point [my height, 25] with radii [25, 25] rotated by 0 on tPath
2815
+
2816
+
// Trace the bottom edge
2817
+
line to point [my width - 25, my height] on tPath
2818
+
2819
+
// Continue path with an arc to the right edge
2820
+
arc to point [my width, my height - 25] with radii [25, 25] rotated by 0 on tPath
2821
+
2822
+
// Trace the right edge
2823
+
line to point [my width, 0] on tPath
2824
+
2825
+
// Close the path with a line back to the starting point
0 commit comments