Exemplo n.º 1
0
        private static IPath BuildPathsForColor(IGrouping <string, XElement> colorGroup)
        {
            var pathBuilder = new PathBuilder();

            foreach (var element in colorGroup)
            {
                pathBuilder.StartFigure();

                if (element.Name == "Line")
                {
                    pathBuilder.AddLine(
                        float.Parse(element.Element("XStart").Value),
                        ImageSize - float.Parse(element.Element("YStart").Value),
                        float.Parse(element.Element("XEnd").Value),
                        ImageSize - float.Parse(element.Element("YEnd").Value));
                }
                else if (element.Name == "Arc")
                {
                    pathBuilder.AddEllipticalArc(
                        center: new PointF(
                            float.Parse(element.Element("XCenter").Value),
                            ImageSize - float.Parse(element.Element("YCenter").Value)),
                        radiusX: float.Parse(element.Element("Radius").Value),
                        radiusY: float.Parse(element.Element("Radius").Value),
                        rotation: -90f,
                        startAngle: float.Parse(element.Element("ArcStart").Value),
                        sweepAngle: float.Parse(element.Element("ArcExtend").Value));
                }
            }

            return(pathBuilder.Build());
        }
Exemplo n.º 2
0
        public void AddEllipticArc()
        {
            var builder = new PathBuilder();

            builder.AddEllipticalArc(new PointF(10, 10), 10, 10, 0, 0, 360);

            Assert.IsType <Path>(builder.Build());
        }