Polyline.cs 828 B

12345678910111213141516171819202122232425262728293031
  1. using Avalonia;
  2. using Avalonia.Controls;
  3. using Avalonia.Controls.Shapes;
  4. using Avalonia.Media;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace InABox.Avalonia.Components.ImageEditing;
  11. internal class PolylineObject : IImageEditorObject
  12. {
  13. public List<Point> Points { get; set; } = new List<Point>();
  14. public double Thickness { get; set; } = 1.0;
  15. public IBrush? PrimaryBrush { get; set; }
  16. private Polyline Control = new();
  17. public Control GetControl() => Control;
  18. public void Update()
  19. {
  20. Control.Points = Points.ToList();
  21. Control.Stroke = PrimaryBrush;
  22. Control.StrokeThickness = Thickness;
  23. Control.StrokeLineCap = PenLineCap.Round;
  24. Control.StrokeJoin = PenLineJoin.Round;
  25. }
  26. }