/// <summary> /// 它创建了一个新的SVG椭圆元素。 /// </summary> public SVGEllipse AddEllipse(SVGUnit parent, ref SVGUnit last) { SVGEllipse ellipse = new SVGEllipse(this); AddElement(parent, ellipse, ref last); return(ellipse); }
public static DrawEllipseObject Create(SVGEllipse svg) { try { float cx = ParseSize(svg.CX, Dpi.X); float cy = ParseSize(svg.CY, Dpi.Y); float rx = ParseSize(svg.RX, Dpi.X); float ry = ParseSize(svg.RY, Dpi.Y); var dobj = new DrawEllipseObject(cx - rx, cy - ry, rx * 2, ry * 2); dobj.SetStyleFromSvg(svg); return(dobj); } catch (Exception ex) { SVGErr.Log("DrawEllipse", "CreateRectangle", ex.ToString(), SVGErr._LogPriority.Info); return(null); } }
static void Main(string[] args) { var circle = new SVGCircle(new Point(250.0, 550.0), 20.0, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2 ); var ellipse = new SVGEllipse(new Point(450.0, 550.0), 20.0, 10.0, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2 ); var points = new List <Point>() { new Point(70, 5), new Point(90, 41), new Point(136, 48), new Point(103, 80), new Point(111, 126), new Point(70, 105), new Point(29, 126), new Point(36, 80), new Point(5, 48), new Point(48, 41) }; var pathdata = new List <Point>() { new Point(200, 100), new Point(250, 210), new Point(16, 210) }; var path = new SVGPath(pathdata, new Color(255, 100, 56, 0), new Color(0, 0, 0, 0), 2); var polygon = new SVGPolygon(points, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2); var rect = new SVGRect(50.0, 20.0, 50.0, 20.0, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2); SVGIO.export(new List <SVGShape>() { polygon, ellipse, circle, rect, path }, "Z:\\Sources\\VectorGraphicsEditor\\IO Tests\\output\\mix.svg", 1000, 1001); // SVGIO.import("Z:\\Sources\\VectorGraphicsEditor\\IO Tests\\output\\Freesample.svg"); }