using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media; using System.Windows.Shapes; namespace Tango.Graphics2D.VisualBinders { public class EllipseBinder : IVisualBinder { public void DrawVisual(FrameworkElement element, Drawing2DHost host, DrawingContext context) { Ellipse ellipse = element as Ellipse; var location = host.GetElementLocation(ellipse); var size = host.GetElementSize(ellipse); Pen pen = null; if (ellipse.Stroke != null) { pen = new Pen(ellipse.Stroke, ellipse.StrokeThickness); pen.DashCap = ellipse.StrokeDashCap; //TODO: add some stroke features... } context.DrawEllipse(ellipse.Fill, pen, new Point(location.X + size.Width / 2, location.Y + size.Height / 2), size.Width / 2, size.Height / 2); } public List GetRenderProperties() { return new List() { Ellipse.OpacityProperty, Ellipse.VisibilityProperty, Ellipse.FillProperty, }; } } }