The SVGRectElement interface corresponds to the 'rect' element.
Inheritance: SvgTransformableElement, ISharpGDIPath, ISvgRectElement, IGraphicsElement
Exemplo n.º 1
0
 public void SetUp()
 {
     if(doc == null)
     {
         SvgWindow wnd = new SvgWindow(100, 100, null);
         doc = new SvgDocument(wnd);
         doc.Load("events_01.svg");
         rect = (SvgRectElement)doc.SelectSingleNode("//*[local-name()='rect']");
         g = (SvgGElement)doc.SelectSingleNode("//*[local-name()='g']");
     }
     eventStatus = 0;
 }
Exemplo n.º 2
0
        public static GraphicsPath CreatePath(SvgRectElement element)
        {
            GraphicsPath gp = new GraphicsPath();

            RectangleF rect = new RectangleF((float)element.X.AnimVal.Value,
                (float)element.Y.AnimVal.Value, (float)element.Width.AnimVal.Value,
                (float)element.Height.AnimVal.Value);

            float rx = (float)element.Rx.AnimVal.Value;
            float ry = (float)element.Ry.AnimVal.Value;

            if (rx == 0F && ry == 0F)
            {
                gp.AddRectangle(rect);
            }
            else
            {
                AddRoundedRect(gp, rect, rx, ry);
            }

            return gp;
        }
Exemplo n.º 3
0
        public static Geometry CreateGeometry(SvgRectElement element)
        {
            double dx     = Math.Round(element.X.AnimVal.Value, 4);
            double dy     = Math.Round(element.Y.AnimVal.Value, 4);
            double width  = Math.Round(element.Width.AnimVal.Value, 4);
            double height = Math.Round(element.Height.AnimVal.Value, 4);
            double rx = Math.Round(element.Rx.AnimVal.Value, 4);
            double ry = Math.Round(element.Ry.AnimVal.Value, 4);

            if (width <= 0 || height <= 0)
            {
                return null;
            }
            if (rx <= 0 && ry > 0)
            {
                rx = ry;
            }
            else if (rx > 0 && ry <= 0)
            {
                ry = rx;
            }

            return new RectangleGeometry(new Rect(dx, dy, width, height), rx, ry);
        }