public override void RenderObject(Graphics g, DrawContext dcxt) { GraphicsPath path = new GraphicsPath(); foreach (Object ch in pathes) { if (ch is VectorPathLine) { VectorPathLine vpl = (VectorPathLine)ch; path.AddLine(dcxt.X_V2S(vpl.x1), dcxt.Y_V2S(vpl.y1), dcxt.X_V2S(vpl.x2), dcxt.Y_V2S(vpl.y2)); } else if (ch is VectorPathArc) { VectorPathArc vpa = (VectorPathArc)ch; path.AddArc(dcxt.X_V2S(vpa.x - vpa.w / 2), dcxt.Y_V2S(vpa.y - vpa.h/2), dcxt.W_V2S(vpa.w), dcxt.H_V2S(vpa.h), vpa.startagl, vpa.sweepagl); } else if (ch is VectorPathPie) { VectorPathPie vpp = (VectorPathPie)ch; path.AddArc(dcxt.X_V2S(vpp.x - vpp.w / 2), dcxt.Y_V2S(vpp.y - vpp.h/2), dcxt.W_V2S(vpp.w), dcxt.H_V2S(vpp.h), vpp.startagl, vpp.sweepagl); } } if (fill) g.FillPath(BrushWhenCxt(dcxt).Brush, path); else g.DrawPath(PenWhenCxt(dcxt).Pen, path); }
public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt) { XmlElement box = dom.CreateElement("rect"); box.SetAttribute("x", "" + dcxt.X_V2S(x)); box.SetAttribute("y", "" + dcxt.Y_V2S(y)); box.SetAttribute("width", "" + dcxt.W_V2S(w)); box.SetAttribute("height", "" + dcxt.H_V2S(h)); if (fill) box.SetAttribute("style", VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush)); else box.SetAttribute("style", VectorSvgUtils.Pen2Style(PenWhenCxt(dcxt).Pen) + "fill:none;"); return box; }
public override void RenderObject(Graphics g, DrawContext dcxt) { if (fill) g.FillRectangle(BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x), dcxt.Y_V2S(y), dcxt.W_V2S(w), dcxt.W_V2S(h)); else g.DrawRectangle(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x), dcxt.Y_V2S(y), dcxt.W_V2S(w), dcxt.W_V2S(h)); }
public override void RenderObject(Graphics g, DrawContext dcxt) { g.DrawString(text, FontWhenCxt(dcxt).Font, BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x), dcxt.Y_V2S(y)); }
public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt) { XmlElement text = dom.CreateElement("text"); String style = VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush) + "font-size:" + FontWhenCxt(dcxt).Font.Size+";"; text.SetAttribute("x", "" + dcxt.X_V2S(x)); text.SetAttribute("y", "" + dcxt.Y_V2S(y + FontWhenCxt(dcxt).Font.Size + 2)); //text.SetAttribute("y", "" + dcxt.Y_V2S(y)); text.SetAttribute("style", style); if (this.text.Contains("\n")) { if (G == null) G = Graphics.FromImage(new Bitmap(1, 1)); Font font = FontWhenCxt(dcxt).Font; SizeF sf = new SizeF(0, 0); foreach (String l in this.text.Split('\n')) { XmlElement xl = dom.CreateElement("tspan"); xl.SetAttribute("dx", "-" + dcxt.W_V2S(sf.Width)); xl.SetAttribute("dy", ""+ dcxt.H_V2S(sf.Height)); sf = G.MeasureString(l, font); xl.InnerText = l; text.AppendChild(xl); } } else { text.InnerText = this.text; } return text; }
public override void RenderObject(Graphics g, DrawContext dcxt) { if (fill) g.FillPie(BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x-w/2), dcxt.Y_V2S(y-h/2), dcxt.W_V2S(w), dcxt.W_V2S(h), startagl, sweepagl); else g.DrawPie(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.W_V2S(h), startagl, sweepagl); }
public override void RenderObject(Graphics g, DrawContext dcxt) { g.DrawArc(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.W_V2S(h), startagl, sweepagl); }
public override void RenderObject(Graphics g, DrawContext dcxt) { g.DrawLine(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x1), dcxt.Y_V2S(y1), dcxt.X_V2S(x2), dcxt.Y_V2S(y2)); }
public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt) { XmlElement line = dom.CreateElement("line"); // <line x1="0" y1="0" x2="300" y2="300" style="stroke:rgb(99,99,99);stroke-width:2"/> line.SetAttribute("x1", "" + dcxt.X_V2S(x1)); line.SetAttribute("y1", "" + dcxt.Y_V2S(y1)); line.SetAttribute("x2", "" + dcxt.X_V2S(x2)); line.SetAttribute("y2", "" + dcxt.Y_V2S(y2)); line.SetAttribute("style", VectorSvgUtils.Pen2Style(PenWhenCxt(dcxt).Pen)); return line; }
public override void RenderObject(Graphics g, DrawContext dcxt) { DrawContext ndcxt = new DrawContext(dcxt.Scale, dcxt.X_V2S(x), dcxt.Y_V2S(y)); foreach (VectorObject vo in Children) { if(vo.Display) vo.RenderObject(g, ndcxt); } }
public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt) { DrawContext ndcxt = new DrawContext(dcxt.Scale, dcxt.X_V2S(x), dcxt.Y_V2S(y)); XmlElement ele = dom.CreateElement("g"); foreach (VectorObject vo in Children) { XmlElement cle = vo.ExportSvg(dom, ndcxt); if (cle != null) ele.AppendChild(cle); } return ele; }
public override void RenderObject(Graphics g, DrawContext dcxt) { if (fill) g.FillEllipse(BrushWhenCxt(dcxt).Brush, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.H_V2S(h)); else g.DrawEllipse(PenWhenCxt(dcxt).Pen, dcxt.X_V2S(x - w / 2), dcxt.Y_V2S(y - h / 2), dcxt.W_V2S(w), dcxt.H_V2S(h)); }
public override XmlElement ExportSvg(XmlDocument dom, DrawContext dcxt) { XmlElement circle = dom.CreateElement("ellipse"); circle.SetAttribute("cx", "" + dcxt.X_V2S(x)); circle.SetAttribute("cy", "" + dcxt.Y_V2S(y)); circle.SetAttribute("rx", "" + dcxt.W_V2S(w/2)); circle.SetAttribute("ry", "" + dcxt.H_V2S(h/2)); if (fill) circle.SetAttribute("style", VectorSvgUtils.Brush2Style(BrushWhenCxt(dcxt).Brush)); else circle.SetAttribute("style", VectorSvgUtils.Pen2Style(PenWhenCxt(dcxt).Pen) + "fill:none;"); return circle; }