예제 #1
0
        //--------------------------------------------------------------------------------------------------

        internal override bool Read(XmlReader reader, SvgConverter conv)
        {
            bool   res = false;
            string sx  = reader.GetAttribute("cx") ?? "0";
            string sy  = reader.GetAttribute("cy") ?? "0";
            string srx = reader.GetAttribute("rx");
            string sry = reader.GetAttribute("ry");

            if (!base.Read(reader, conv))
            {
                return(false);
            }

            if (!sx.IsNullOrEmpty() && !sy.IsNullOrEmpty() && !srx.IsNullOrEmpty() && !sry.IsNullOrEmpty())
            {
                var localCenter = new Pnt2d(conv.FromSvgLength(sx), conv.FromSvgLength(sy));
                Center    = localCenter;
                RadiusX   = conv.FromSvgLength(srx);
                RadiusY   = conv.FromSvgLength(sry);
                RimPointX = (localCenter + new Pnt2d(RadiusX, 0));
                RimPointY = (localCenter + new Pnt2d(0, RadiusY));

                conv.Transform(ref Center);
                conv.Transform(ref RimPointX);
                conv.Transform(ref RimPointY);
                res = true;
            }

            conv.PopTransform();
            return(res);
        }
예제 #2
0
        //--------------------------------------------------------------------------------------------------

        internal override bool Read(XmlReader reader, SvgConverter conv)
        {
            bool   res = false;
            string sx1 = reader.GetAttribute("x1") ?? "0";
            string sy1 = reader.GetAttribute("y1") ?? "0";
            string sx2 = reader.GetAttribute("x2") ?? "0";
            string sy2 = reader.GetAttribute("y2") ?? "0";

            if (!base.Read(reader, conv))
            {
                return(false);
            }

            if (!(sx1.IsNullOrEmpty() && sy1.IsNullOrEmpty() && sx2.IsNullOrEmpty() && sy2.IsNullOrEmpty()))
            {
                Start = new Pnt2d(conv.FromSvgLength(sx1), conv.FromSvgLength(sy1));
                conv.Transform(ref Start);
                End = new Pnt2d(conv.FromSvgLength(sx1), conv.FromSvgLength(sy1));
                conv.Transform(ref End);
                res = true;
            }

            conv.PopTransform();
            return(res);
        }
예제 #3
0
        //--------------------------------------------------------------------------------------------------

        internal override bool Read(XmlReader reader, SvgConverter conv)
        {
            bool   res = false;
            string sx  = reader.GetAttribute("x") ?? "0";
            string sy  = reader.GetAttribute("y") ?? "0";
            string sw  = reader.GetAttribute("width") ?? "0";
            string sh  = reader.GetAttribute("height") ?? "0";
            string srx = reader.GetAttribute("rx") ?? "0";
            string sry = reader.GetAttribute("ry") ?? "0";

            if (!base.Read(reader, conv))
            {
                return(false);
            }

            if (!(sx.IsNullOrEmpty() && sy.IsNullOrEmpty() && sw.IsNullOrEmpty() && sh.IsNullOrEmpty()))
            {
                Start = new Pnt2d(conv.FromSvgLength(sx), conv.FromSvgLength(sy));
                conv.Transform(ref Start);
                Width         = conv.FromSvgLength(sw);
                Height        = -conv.FromSvgLength(sh);
                CornerRadiusX = conv.FromSvgLength(srx);
                CornerRadiusY = -conv.FromSvgLength(sry);
                res           = true;
            }

            conv.PopTransform();
            return(res);
        }
예제 #4
0
        //--------------------------------------------------------------------------------------------------

        internal override bool Read(XmlReader reader, SvgConverter conv)
        {
            bool   res = false;
            string sx  = reader.GetAttribute("cx") ?? "0";
            string sy  = reader.GetAttribute("cy") ?? "0";
            string sr  = reader.GetAttribute("r");

            if (!base.Read(reader, conv))
            {
                return(false);
            }

            if (!sx.IsNullOrEmpty() && !sy.IsNullOrEmpty() && !sr.IsNullOrEmpty())
            {
                Center = new Pnt2d(conv.FromSvgLength(sx), conv.FromSvgLength(sy));
                conv.Transform(ref Center);
                Radius = conv.FromSvgLength(sr);
                res    = true;
            }

            conv.PopTransform();
            return(res);
        }