public static void DrawPath(ICanvas2D dc, Matrix3x2 xform, string path, OutlineFillStyle style) { var shapes = ParseShapes(path); foreach (var shape in shapes) { var points = shape.AsSpan(); if (points[0].Equals(points[points.Length - 1])) { points = points.Slice(0, points.Length - 1); dc.DrawPolygon(points, style); continue; } if (style.HasFill) { dc.DrawPolygon(points, style.FillColor); } if (style.HasOutline) { dc.DrawLines(points, style.OutlineWidth, style.OutlineColor); } } }