Exemplo n.º 1
0
        public void Write()
        {
            if (wrote)
            {
                return;
            }
            wrote = true;

            w.WriteLine("<?xml version=\"1.0\" encoding=\"{0}\" standalone=\"no\"?>", w.Encoding.WebName.ToUpperInvariant());
            w.WriteLine("<svg width=\"{0}px\" height=\"{1}px\" viewBox=\"{2} {3} {4} {5}\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">",
                        Graphic.Size.Width, Graphic.Size.Height,
                        Graphic.ViewBox.X, Graphic.ViewBox.Y,
                        Graphic.ViewBox.Width, Graphic.ViewBox.Height);
            w.Indent();
            w.WriteLine("<title>{0}</title>", Escape(Graphic.Title));
            w.WriteLine("<description>{0}</description>", Escape(Graphic.Description));
            w.WriteLine("<defs>");
            w.Indent();
            var dw = new DefsWriter {
                w = w, defs = defs
            };

            foreach (var c in Graphic.Children)
            {
                c.Accept(dw);
            }
            w.Outdent();
            w.WriteLine("</defs>");
            foreach (var c in Graphic.Children)
            {
                c.Accept(this);
            }
            w.Outdent();
            w.WriteLine("</svg>");
        }
Exemplo n.º 2
0
		public void Write ()
		{
			if (wrote)
				return;
			wrote = true;

			w.WriteLine ("<?xml version=\"1.0\" encoding=\"{0}\" standalone=\"no\"?>", w.Encoding.WebName.ToUpperInvariant ());
			w.WriteLine ("<svg width=\"{0}px\" height=\"{1}px\" viewBox=\"{2} {3} {4} {5}\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">",
				Graphic.Size.Width, Graphic.Size.Height,
				Graphic.ViewBox.X, Graphic.ViewBox.Y,
				Graphic.ViewBox.Width, Graphic.ViewBox.Height);
			w.Indent ();
			w.WriteLine ("<title>{0}</title>", Escape (Graphic.Title));
			w.WriteLine ("<description>{0}</description>", Escape (Graphic.Description));
			w.WriteLine ("<defs>");
			w.Indent ();
			var dw = new DefsWriter { w = w, defs = defs };
			foreach (var c in Graphic.Children) {
				c.Accept (dw);
			}
			w.Outdent ();
			w.WriteLine ("</defs>");
			foreach (var c in Graphic.Children) {
				c.Accept (this);
			}
			w.Outdent ();
			w.WriteLine ("</svg>");
		}