Example #1
0
        public static SVGPathElement LineRel(float dx, float dy)
        {
            SVGPathElement element = new SVGPathElement(StrokeType.Line, true);

            element.points[0] = new PointF(dx, dy);
            return(element);
        }
Example #2
0
        public static SVGPathElement LineTo(float x, float y)
        {
            SVGPathElement element = new SVGPathElement(StrokeType.Line, false);

            element.points[0] = new PointF(x, y);
            return(element);
        }
Example #3
0
        public static SVGPathElement QuadraticRel(float dx1, float dy1, float dx, float dy)
        {
            SVGPathElement element = new SVGPathElement(StrokeType.Cubic, true);

            element.points[0] = new PointF(dx1, dy1);
            element.points[1] = new PointF(dx, dy);
            return(element);
        }
Example #4
0
        public static SVGPathElement Quadratic(float cx1, float cy1, float x, float y)
        {
            SVGPathElement element = new SVGPathElement(StrokeType.Cubic, false);

            element.points[0] = new PointF(cx1, cy1);
            element.points[1] = new PointF(x, y);
            return(element);
        }
Example #5
0
        public static SVGPathElement ArcRel(float rx, float ry, float angle, bool largeArc, bool sweep, float dx, float dy)
        {
            SVGPathElement element = new SVGPathElement(StrokeType.Arc, true);

            element.points[0] = new PointF(rx, ry);
            element.points[1] = new PointF(angle, (largeArc ? 1.0f : 0.0f) + (sweep ? 2.0f : 0.0f)); // UGH!
            element.points[2] = new PointF(dx, dy);
            return(element);
        }
Example #6
0
        public SVGPath(IEnumerable <PointF> points, bool closed)
        {
            if (points == null || !points.Any())
            {
                throw new ArgumentException("No points for SVG path");
            }

            PointF prev = points.First();

            Elements.Add(SVGPathElement.MoveTo(prev));
            foreach (PointF p in points.Skip(1))
            {
                if (p != prev)
                {
                    Elements.Add(SVGPathElement.LineTo(p));
                }
                prev = p;
            }
            if (closed)
            {
                Elements.Add(SVGPathElement.Close());
            }
        }