From e0bed9a532a9145778f575ef1409a2cca13a2429 Mon Sep 17 00:00:00 2001 From: Splitwirez Date: Thu, 25 Feb 2021 16:01:06 -0500 Subject: [PATCH] Added `Parse` method to `PathFigures` class --- .../Media/PathGeometryCollections.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Avalonia.Visuals/Media/PathGeometryCollections.cs b/src/Avalonia.Visuals/Media/PathGeometryCollections.cs index 61099a0956..1589d2f5be 100644 --- a/src/Avalonia.Visuals/Media/PathGeometryCollections.cs +++ b/src/Avalonia.Visuals/Media/PathGeometryCollections.cs @@ -1,9 +1,27 @@ using Avalonia.Collections; +using Avalonia.Visuals.Platform; namespace Avalonia.Media { public sealed class PathFigures : AvaloniaList { + /// + /// Parses the specified path data to a . + /// + /// The s. + /// + public static PathFigures Parse(string pathData) + { + var pathGeometry = new PathGeometry(); + + using (var context = new PathGeometryContext(pathGeometry)) + using (var parser = new PathMarkupParser(context)) + { + parser.Parse(pathData); + } + + return pathGeometry.Figures; + } } public sealed class PathSegments : AvaloniaList