diff --git a/Azaion.Annotator/Controls/AnnotationControl.cs b/Azaion.Annotator/Controls/AnnotationControl.cs index 5810b88..54e73c0 100644 --- a/Azaion.Annotator/Controls/AnnotationControl.cs +++ b/Azaion.Annotator/Controls/AnnotationControl.cs @@ -10,7 +10,7 @@ namespace Azaion.Annotator.Controls; public class AnnotationControl : Border { private readonly Action _resizeStart; - private const double RESIZE_RECT_SIZE = 10; + private const double RESIZE_RECT_SIZE = 9; private readonly Grid _grid; private readonly TextBlock _classNameLabel; @@ -52,14 +52,14 @@ public class AnnotationControl : Border VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, 15, 0, 0), FontSize = 14, - Cursor = Cursors.Arrow + Cursor = Cursors.SizeAll }; _selectionFrame = new Rectangle { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Stroke = new SolidColorBrush(Colors.Black), - StrokeThickness = 3, + StrokeThickness = 2, Visibility = Visibility.Collapsed }; @@ -79,9 +79,7 @@ public class AnnotationControl : Border AddRect("rLB", HorizontalAlignment.Left, VerticalAlignment.Bottom, Cursors.SizeNESW), AddRect("rCB", HorizontalAlignment.Center, VerticalAlignment.Bottom, Cursors.SizeNS), AddRect("rRB", HorizontalAlignment.Right, VerticalAlignment.Bottom, Cursors.SizeNWSE) - }, - - Background = new SolidColorBrush(annotationClass.Color) + } }; Child = _grid; Cursor = Cursors.SizeAll; @@ -97,7 +95,7 @@ public class AnnotationControl : Border VerticalAlignment = va, Width = RESIZE_RECT_SIZE, Height = RESIZE_RECT_SIZE, - Stroke = new SolidColorBrush(Color.FromRgb(10, 10, 10)), // small rectangles color + Stroke = new SolidColorBrush(Color.FromArgb(230, 40, 40, 40)), // small rectangles color Fill = new SolidColorBrush(Color.FromArgb(1, 255, 255, 255)), Cursor = crs, Name = name, diff --git a/Azaion.Annotator/DTO/AnnotationClass.cs b/Azaion.Annotator/DTO/AnnotationClass.cs index 0850e66..df1fa19 100644 --- a/Azaion.Annotator/DTO/AnnotationClass.cs +++ b/Azaion.Annotator/DTO/AnnotationClass.cs @@ -1,4 +1,5 @@ -using System.Windows.Media; +using System.Text.Json.Serialization; +using System.Windows.Media; using Azaion.Annotator.Extensions; namespace Azaion.Annotator.DTO; @@ -10,6 +11,9 @@ public class AnnotationClass(int id, string name = "") public string Name { get; set; } = name; public Color Color { get; set; } = id.ToColor(); + [JsonIgnore] public int ClassNumber => Id + 1; + + [JsonIgnore] public SolidColorBrush ColorBrush => new(Color); } \ No newline at end of file diff --git a/Azaion.Annotator/DTO/Config.cs b/Azaion.Annotator/DTO/Config.cs index 81e30ba..b66f0d5 100644 --- a/Azaion.Annotator/DTO/Config.cs +++ b/Azaion.Annotator/DTO/Config.cs @@ -1,5 +1,6 @@ using System.IO; using System.Text; +using System.Windows.Media; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Size = System.Windows.Size; diff --git a/Azaion.Annotator/Extensions/ColorExtensions.cs b/Azaion.Annotator/Extensions/ColorExtensions.cs index e0dcafe..44057d4 100644 --- a/Azaion.Annotator/Extensions/ColorExtensions.cs +++ b/Azaion.Annotator/Extensions/ColorExtensions.cs @@ -7,20 +7,14 @@ public static class ColorExtensions public static Color ToColor(this int id) { var index = id % ColorValues.Length; - return ToColor($"#{ColorValues[index]}"); - } - - public static Color ToColor(string hex) - { - var color = (Color)ColorConverter.ConvertFromString(hex); - color.A = 128; + var hex = $"#40{ColorValues[index]}"; + var color =(Color)ColorConverter.ConvertFromString(hex); return color; } - private static readonly string[] ColorValues = [ - "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "000000", + "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "000000", "800000", "008000", "000080", "808000", "800080", "008080", "808080", "C00000", "00C000", "0000C0", "C0C000", "C000C0", "00C0C0", "C0C0C0", "400000", "004000", "000040", "404000", "400040", "004040", "404040", diff --git a/Azaion.Annotator/config.json b/Azaion.Annotator/config.json index 81bf945..8f6c036 100644 --- a/Azaion.Annotator/config.json +++ b/Azaion.Annotator/config.json @@ -7,69 +7,59 @@ { "Id": 0, "Name": "Броньована техніка", - "Color": "#80FF0000", - "ColorBrush": "#80FF0000" + "Color": "#40FF0000" }, { "Id": 1, "Name": "Вантажівка", - "Color": "#8000FF00", - "ColorBrush": "#8000FF00" + "Color": "#4000FF00" }, { "Id": 2, "Name": "Машина легкова", - "Color": "#800000FF", - "ColorBrush": "#800000FF" + "Color": "#400000FF" }, { "Id": 3, "Name": "Артилерія", - "Color": "#80FFFF00", - "ColorBrush": "#80FFFF00" + "Color": "#40FFFF00" }, { "Id": 4, "Name": "Тінь від техніки", - "Color": "#80FF00FF", - "ColorBrush": "#80FF00FF" + "Color": "#40FF00FF" }, { "Id": 5, "Name": "Окопи", - "Color": "#8000FFFF", - "ColorBrush": "#8000FFFF" + "Color": "#4000FFFF" }, { "Id": 6, "Name": "Військовий", - "Color": "#80000000", - "ColorBrush": "#80000000" + "Color": "#40000000" }, { "Id": 7, "Name": "Накати", - "Color": "#80800000", - "ColorBrush": "#80800000" + "Color": "#40800000" }, { "Id": 8, "Name": "Танк з захистом", - "Color": "#80008000", - "ColorBrush": "#80008000" + "Color": "#40008000" }, { "Id": 9, "Name": "Дим", - "Color": "#80000080", - "ColorBrush": "#80000080" + "Color": "#40000080" } ], "WindowSize": "1920,1080", "WindowLocation": "200,121", "FullScreen": true, - "LeftPanelWidth": 30, - "RightPanelWidth": 30, + "LeftPanelWidth": 300, + "RightPanelWidth": 300, "ShowHelpOnStart": false, "VideoFormats": ["mov", "mp4"], "ImageFormats": ["jpg", "jpeg", "png", "bmp", "gif"]