public static GraphicsPath CreatePath(SvgEllipseElement element) { GraphicsPath gp = new GraphicsPath(); float _cx = (float)element.Cx.AnimVal.Value; float _cy = (float)element.Cy.AnimVal.Value; float _rx = (float)element.Rx.AnimVal.Value; float _ry = (float)element.Ry.AnimVal.Value; /*if (_cx <= 1 && _cy <= 1 && _rx <= 1 && _ry <= 1) { gp.AddEllipse(_cx-_rx, _cy-_ry, _rx*2, _ry*2); } else { gp.AddEllipse(_cx-_rx, _cy-_ry, _rx*2 - 1, _ry*2 - 1); }*/ gp.AddEllipse(_cx - _rx, _cy - _ry, _rx * 2, _ry * 2); return gp; }
public static Geometry CreateGeometry(SvgEllipseElement element) { double _cx = Math.Round(element.Cx.AnimVal.Value, 4); double _cy = Math.Round(element.Cy.AnimVal.Value, 4); double _rx = Math.Round(element.Rx.AnimVal.Value, 4); double _ry = Math.Round(element.Ry.AnimVal.Value, 4); if (_rx <= 0 || _ry <= 0) { return null; } /*if (_cx <= 1 && _cy <= 1 && _rx <= 1 && _ry <= 1) { gp.AddEllipse(_cx-_rx, _cy-_ry, _rx*2, _ry*2); } else { gp.AddEllipse(_cx-_rx, _cy-_ry, _rx*2 - 1, _ry*2 - 1); }*/ //gp.AddEllipse(_cx - _rx, _cy - _ry, _rx * 2, _ry * 2); EllipseGeometry geometry = new EllipseGeometry(new Point(_cx, _cy), _rx, _ry); return geometry; }