private SVGPathSegClosePath CreateSVGPathSegClosePath() { SVGPathSeg lastSegment = _segList.GetLastItem(); SVGPathSeg firstSegment = _segList.GetItem(0); /* * SVGPathSegMovetoAbs _firstPoint = _segList.GetItem(0) as SVGPathSegMovetoAbs; * if (_firstPoint == null) * { * SVGPathSegMovetoRel _firstPoint1 = _segList.GetItem(0) as SVGPathSegMovetoRel; * if (_firstPoint1 != null) * return new SVGPathSegClosePath(_firstPoint1.currentPoint, lastSegment); * } else * { * return new SVGPathSegClosePath(_firstPoint.currentPoint, lastSegment); * } */ if (firstSegment != null) { return(new SVGPathSegClosePath(firstSegment.currentPoint, lastSegment)); } else { return(null); } }
private SVGPathSegClosePath CreateSVGPathSegClosePath() { SVGPathSeg lastSegment = _segList.GetLastItem(); SVGPathSeg firstSegment = _segList.GetItem(0); if (firstSegment != null) { return(new SVGPathSegClosePath(firstSegment.currentPoint, lastSegment)); } else { return(null); } }
public static List <List <Vector2> > GetPaths(SVGMatrix matrix, SVGPathElement svgElement) { lastCommand = SVGPathSegTypes.Unknown; List <Vector2> positionBuffer = new List <Vector2>(); List <List <Vector2> > output = new List <List <Vector2> >(); SVGPathSegList segList = svgElement.segList; for (int i = 0; i < segList.Count; i++) { GetSegment(svgElement, segList.GetItem(i), output, positionBuffer, matrix); } if (lastCommand != SVGPathSegTypes.Close && positionBuffer.Count > 0) { output.Add(new List <Vector2>(positionBuffer.ToArray())); } //Vector2 startPoint, endPoint; for (int i = 0; i < output.Count; i++) { // Ramer Douglas Peucker Reduction if (output[i] == null || output[i].Count < 3) { continue; } output[i] = SVGBezier.Optimise(output[i], SVGGraphics.vpm); } return(output); }