Example #1
0
        /// <summary>
        /// Parse a circle
        /// </summary>
        private static GraphicPathGeometry ParseCircle(XElement path)
        {
            var cx     = GetDoubleAttr(path, "cx");
            var cy     = GetDoubleAttr(path, "cy");
            var radius = GetDoubleAttr(path, "r");

            var ellipse = EllipseToGeometryConverter.EllipseToGeometry(new Point(cx, cy), radius, radius);

            return(ellipse);
        }
Example #2
0
        /// <summary>
        /// Parse a circle
        /// </summary>
        private GraphicPathGeometry ParseCircle(XElement path)
        {
            var cx     = GetLengthPercentAttr(path, "cx", PercentBaseSelector.ViewBoxWidth);
            var cy     = GetLengthPercentAttr(path, "cy", PercentBaseSelector.ViewBoxHeight);
            var radius = GetLengthPercentAttr(path, "r", PercentBaseSelector.ViewBoxDiagonal);

            var ellipse = EllipseToGeometryConverter.EllipseToGeometry(new Point(cx, cy), radius, radius);

            return(ellipse);
        }
Example #3
0
        /// <summary>
        /// Parse an ellipse
        /// </summary>
        private GraphicPathGeometry ParseEllipse(XElement path)
        {
            var cx = GetLengthPercentAttr(path, "cx", PercentBaseSelector.ViewBoxWidth);
            var cy = GetLengthPercentAttr(path, "cy", PercentBaseSelector.ViewBoxHeight);
            var rx = doubleParser.GetLengthPercentAuto(path, "rx", PercentBaseSelector.ViewBoxWidth);
            var ry = doubleParser.GetLengthPercentAuto(path, "ry", PercentBaseSelector.ViewBoxHeight);

            double rxVal;
            double ryVal;

            if (rx.IsAuto)
            {
                rxVal = 0.0;
            }
            else
            {
                rxVal = rx.Value;
            }

            if (ry.IsAuto)
            {
                ryVal = rxVal;
            }
            else
            {
                ryVal = ry.Value;
            }

            if (rx.IsAuto)
            {
                rxVal = ryVal;
            }

            var ellipse = EllipseToGeometryConverter.EllipseToGeometry(new Point(cx, cy), rxVal, ryVal);

            return(ellipse);
        }