public static void Create(ISVGElement svgElement, string defaultName = null, ClosePathRule closePathRule = ClosePathRule.ALWAYS) { if (svgElement == null) { return; } if (svgElement.paintable.visibility != SVGVisibility.Visible || svgElement.paintable.display == SVGDisplay.None) { return; } List <SVGShape> shapes = new List <SVGShape>(); List <List <Vector2> > inputPaths = svgElement.GetPath(); if (inputPaths.Count == 1) { if (svgElement.paintable.IsFill()) { List <List <Vector2> > path = inputPaths; if (svgElement.paintable.clipPathList != null && svgElement.paintable.clipPathList.Count > 0) { path = SVGGeom.ClipPolygon(new List <List <Vector2> >() { inputPaths[0] }, svgElement.paintable.clipPathList); } SVGShape[] addShapes = SVGGraphics.GetShapes(path, svgElement.paintable, svgElement.transformMatrix); if (addShapes != null && addShapes.Length > 0) { shapes.AddRange(addShapes); } } if (svgElement.paintable.IsStroke()) { List <List <Vector2> > path = SVGSimplePath.CreateStroke(inputPaths[0], svgElement.paintable, closePathRule); if (svgElement.paintable.clipPathList != null && svgElement.paintable.clipPathList.Count > 0) { path = SVGGeom.ClipPolygon(path, svgElement.paintable.clipPathList); } SVGShape[] addShapes = SVGGraphics.GetShapes(path, svgElement.paintable, svgElement.transformMatrix, true); if (addShapes != null && addShapes.Length > 0) { shapes.AddRange(addShapes); } } } else { if (svgElement.paintable.IsFill()) { List <List <Vector2> > fillPaths = inputPaths; if (svgElement.paintable.clipPathList != null && svgElement.paintable.clipPathList.Count > 0) { fillPaths = SVGGeom.ClipPolygon(inputPaths, svgElement.paintable.clipPathList); } SVGShape[] addShapes = SVGGraphics.GetShapes(fillPaths, svgElement.paintable, svgElement.transformMatrix); if (addShapes != null && addShapes.Length > 0) { shapes.AddRange(addShapes); } } if (svgElement.paintable.IsStroke()) { List <List <Vector2> > strokePath = SVGSimplePath.CreateStroke(inputPaths, svgElement.paintable, closePathRule); if (svgElement.paintable.clipPathList != null && svgElement.paintable.clipPathList.Count > 0) { strokePath = SVGGeom.ClipPolygon(strokePath, svgElement.paintable.clipPathList); } SVGShape[] addShapes = SVGGraphics.GetShapes(strokePath, svgElement.paintable, svgElement.transformMatrix, true); if (addShapes != null && addShapes.Length > 0) { shapes.AddRange(addShapes); } } } if (shapes.Count > 0) { string name = svgElement.attrList.GetValue("id"); if (string.IsNullOrEmpty(name)) { name = defaultName; } SVGLayer layer = new SVGLayer(); layer.shapes = shapes.ToArray(); layer.name = name; SVGGraphics.AddLayer(layer); } }