public static IEnumerable <SvgPathSegment> Create(SvgPathSegment lastSegment, string commandString, SvgConverter conv)
        {
            if (!conv.TrySplitValues(commandString.Substring(1), out var values, true))
            {
                yield break;
            }

            int valuePos = 0;

            while (valuePos < values.Length)
            {
                var start = lastSegment?.End ?? Pnt2d.Origin;

                Pnt2d c1;
                Pnt2d c2;
                Pnt2d end;
                if (char.ToLower(commandString[0]) == 'c')
                {
                    c1        = new Pnt2d(values[valuePos], values[valuePos + 1]);
                    c2        = new Pnt2d(values[valuePos + 2], values[valuePos + 3]);
                    end       = new Pnt2d(values[valuePos + 4], values[valuePos + 5]);
                    valuePos += 6;

                    if (char.IsLower(commandString[0]))
                    {
                        c1  += start;
                        c2  += start;
                        end += start;
                    }
                    lastSegment = new SvgPathSegCurvetoCubic(start, c1, c2, end);
                    yield return(lastSegment);
                }
                else if (char.ToLower(commandString[0]) == 's')
                {
                    c2        = new Pnt2d(values[valuePos], values[valuePos + 1]);
                    end       = new Pnt2d(values[valuePos + 2], values[valuePos + 3]);
                    valuePos += 4;

                    if (char.IsLower(commandString[0]))
                    {
                        c2  += start;
                        end += start;
                    }

                    if (lastSegment is SvgPathSegCurvetoCubic lastSeg)
                    {
                        c1 = lastSeg.C2;
                    }
                    else
                    {
                        c1 = c2;
                    }
                    lastSegment = new SvgPathSegCurvetoCubic(start, c1, c2, end);
                    yield return(lastSegment);
                }
            }
        }
        //--------------------------------------------------------------------------------------------------

        void _ImportCubicCurveSegment(SvgPathSegCurvetoCubic svgSegment, ref int startPoint)
        {
            var endPoint      = _AddPoint(svgSegment.End);
            var controlPoint1 = _AddPoint(svgSegment.C1);
            var controlPoint2 = _AddPoint(svgSegment.C2);

            _Segments.Add(new SketchSegmentBezier(startPoint, controlPoint1, controlPoint2, endPoint));
            startPoint = endPoint;
        }
        internal static IEnumerable <SvgPathSegment> Create(string pathString, SvgConverter conv)
        {
            SvgPathSegment lastSegment  = null;
            SvgPathSegment firstSegment = null;
            int            next         = 0;

            while (next < pathString.Length)
            {
                int start = next;
                next = pathString.IndexOfAny(_PathCommands, start + 1);
                if (next == -1)
                {
                    next = pathString.Length;
                }

                IEnumerable <SvgPathSegment> newSegments = null;
                var commandString = pathString.Substring(start, next - start);
                switch (char.ToLower(commandString[0]))
                {
                case 'm':
                    newSegments = SvgPathSegMoveto.Create(lastSegment, commandString, conv);
                    break;

                case 'l':
                case 'h':
                case 'v':
                    newSegments = SvgPathSegLineto.Create(lastSegment, commandString, conv);
                    break;

                case 'c':
                case 's':
                    newSegments = SvgPathSegCurvetoCubic.Create(lastSegment, commandString, conv);
                    break;

                case 'q':
                case 't':
                    newSegments = SvgPathSegCurvetoQuadratic.Create(lastSegment, commandString, conv);
                    break;

                case 'a':
                    newSegments = SvgPathSegArc.Create(lastSegment, commandString, conv);
                    break;

                case 'z':
                    lastSegment = SvgPathSegClosePath.Create(firstSegment, lastSegment);
                    yield return(lastSegment);

                    firstSegment = null;
                    continue;
                }

                if (newSegments == null)
                {
                    continue;
                }

                foreach (var segment in newSegments)
                {
                    if (firstSegment == null)
                    {
                        firstSegment = segment;
                    }
                    lastSegment = segment;
                    yield return(segment);
                }
            }
        }