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 LineBinder : IVisualBinder
{
public void DrawVisual(FrameworkElement element, Drawing2DHost host, DrawingContext context)
{
Line line = element as Line;
var location = host.GetElementLocation(line);
var size = host.GetElementSize(line);
Pen pen = null;
if (line.Stroke != null)
{
pen = new Pen(line.Stroke, line.StrokeThickness);
pen.DashCap = line.StrokeDashCap;
//TODO: add some stroke features...
}
context.DrawLine(pen, new Point(line.X1, line.Y1), new Point(line.X2, line.Y2));
}
public List<DependencyProperty> GetRenderProperties()
{
return new List<DependencyProperty>()
{
Line.OpacityProperty,
Line.VisibilityProperty,
Line.StrokeProperty,
Line.X1Property,
Line.Y1Property,
Line.X2Property,
Line.Y2Property,
Line.StrokeThicknessProperty
};
}
}
}