Browse Source

Merge pull request #6 from flabbet/dev

Fixed coordinates calculation and wrote some tests
Krzysztof Krysiński 5 years ago
parent
commit
8924a278b4
38 changed files with 527 additions and 459 deletions
  1. 7 12
      PixiEditorDotNetCore3/Models/Colors/ExColor.cs
  2. 138 138
      PixiEditorDotNetCore3/Models/Controllers/UndoManager.cs
  3. 6 7
      PixiEditorDotNetCore3/Models/DataHolders/Change.cs
  4. 60 60
      PixiEditorDotNetCore3/Models/DataHolders/StackEx.cs
  5. 60 60
      PixiEditorDotNetCore3/Models/DataHolders/Tuple.cs
  6. 1 1
      PixiEditorDotNetCore3/Models/Dialogs/CustomDialog.cs
  7. 1 1
      PixiEditorDotNetCore3/Models/Dialogs/ExportFileDialog.cs
  8. 1 1
      PixiEditorDotNetCore3/Models/Dialogs/ImportFileDialog.cs
  9. 1 1
      PixiEditorDotNetCore3/Models/Dialogs/NewFileDialog.cs
  10. 19 18
      PixiEditorDotNetCore3/Models/IO/Exporter.cs
  11. 2 2
      PixiEditorDotNetCore3/Models/IO/Importer.cs
  12. 103 103
      PixiEditorDotNetCore3/Models/IO/PixiFilesManager.cs
  13. 2 2
      PixiEditorDotNetCore3/Models/Images/BitmapConverter.cs
  14. 1 1
      PixiEditorDotNetCore3/Models/Images/ImageGenerator.cs
  15. 1 1
      PixiEditorDotNetCore3/Models/Layers/BasicLayer.cs
  16. 5 4
      PixiEditorDotNetCore3/Models/Layers/Layer.cs
  17. 4 4
      PixiEditorDotNetCore3/Models/Layers/LayerGenerator.cs
  18. 9 9
      PixiEditorDotNetCore3/Models/Layers/LightLayer.cs
  19. 1 1
      PixiEditorDotNetCore3/Models/Position/Coordinates.cs
  20. 6 4
      PixiEditorDotNetCore3/Models/Position/CoordinatesCalculator.cs
  21. 2 2
      PixiEditorDotNetCore3/Models/Position/DoubleCords.cs
  22. 3 9
      PixiEditorDotNetCore3/Models/Position/MousePositionConverter.cs
  23. 3 2
      PixiEditorDotNetCore3/Models/Tools/BitmapPixelChanges.cs
  24. 3 1
      PixiEditorDotNetCore3/Models/Tools/ShapeTool.cs
  25. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tool.cs
  26. 0 0
      PixiEditorDotNetCore3/Models/Tools/ToolManager.cs
  27. 5 2
      PixiEditorDotNetCore3/Models/Tools/Tools/BrightnessTool.cs
  28. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tools/CircleTool.cs
  29. 4 2
      PixiEditorDotNetCore3/Models/Tools/Tools/EarserTool.cs
  30. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tools/FloodFill.cs
  31. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tools/LineTool.cs
  32. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tools/PenTool.cs
  33. 3 1
      PixiEditorDotNetCore3/Models/Tools/Tools/RectangleTool.cs
  34. 2 0
      PixiEditorDotNetCore3/Models/Tools/ToolsManager.cs
  35. 6 1
      PixiEditorDotNetCore3/ViewModels/ViewModelMain.cs
  36. 27 0
      PixiEditorTests/WorkspaceTests/ColorsTests/ExtendedColorTests.cs
  37. 1 1
      PixiEditorTests/WorkspaceTests/ImageGeneratorTests.cs
  38. 25 3
      PixiEditorTests/WorkspaceTests/ToolsTests/CoordinatesCalculatorTests.cs

+ 7 - 12
PixiEditorDotNetCore3/Models/ExColor.cs → PixiEditorDotNetCore3/Models/Colors/ExColor.cs

@@ -1,13 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media;
+using System.Windows.Media;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Colors
 {
-    public class ExColor
+    public static class ExColor
     {
         /// <summary>
         /// Creates color with corrected brightness.
@@ -18,11 +13,11 @@ namespace PixiEditorDotNetCore3.Models
         /// <returns>
         /// Corrected <see cref="Color"/> structure.
         /// </returns>
-        public static Color ChangeColorBrightness(System.Drawing.Color color, float correctionFactor)
+        public static Color ChangeColorBrightness(Color color, float correctionFactor)
         {
-            float red = (float)color.R;
-            float green = (float)color.G;
-            float blue = (float)color.B;
+            float red = color.R;
+            float green = color.G;
+            float blue = color.B;
 
             if (correctionFactor < 0)
             {

+ 138 - 138
PixiEditorDotNetCore3/Models/UndoManager.cs → PixiEditorDotNetCore3/Models/Controllers/UndoManager.cs

@@ -1,138 +1,138 @@
-using PixiEditor.Helpers;
-using PixiEditorDotNetCore3.Models;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing.Printing;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Media;
-
-namespace PixiEditorDotNetCore3.Models
-{
-    public static class UndoManager
-    {
-        public static StackEx<Change> UndoStack { get; set; } = new StackEx<Change>(); 
-        public static StackEx<Change> RedoStack { get; set; } = new StackEx<Change>();
-        private static bool _stopRecording = false; 
-        private static List<Change> _recordedChanges = new List<Change>();
-        private static bool _lastChangeWasUndo = false;
-        public static bool CanUndo
-        {
-            get
-            {
-                return UndoStack.Count > 0;
-            }
-        }
-        public static bool CanRedo
-        {
-            get
-            {
-                return RedoStack.Count > 0;
-            }
-        }
-
-        public static object MainRoot { get; set; }
-
-        /// <summary>
-        /// Sets object(root) in which undo properties are stored.
-        /// </summary>
-        /// <param name="root">Parent object.</param>
-        public static void SetMainRoot(object root)
-        {
-            MainRoot = root;
-        }
-
-        /// <summary>
-        /// Records changes, used to save multiple changes as one
-        /// </summary>
-        /// <param name="property">Record property name.</param>
-        /// <param name="oldValue">Old change value.</param>
-        /// <param name="newValue">New change value.</param>
-        /// <param name="undoDescription">Description of change.</param>
-        public static void RecordChanges(string property, object oldValue, string undoDescription = "")
-        {
-            if (_stopRecording == false)
-            {
-                if (_recordedChanges.Count >= 2)
-                {
-                    _recordedChanges.RemoveAt(_recordedChanges.Count - 1);
-                }
-                _recordedChanges.Add(new Change(property, oldValue, undoDescription));
-
-            }
-        }
-
-        /// <summary>
-        /// Stops recording changes and saves it as one.
-        /// </summary>
-        public static void StopRecording()
-        {
-                _stopRecording = true;
-            if (_recordedChanges.Count > 0)
-            {
-                Change changeToSave = _recordedChanges[0];
-                changeToSave.NewValue = _recordedChanges.Last().OldValue;
-                AddUndoChange(changeToSave);
-                _recordedChanges.Clear();
-            }
-            _stopRecording = false;
-        }
-
-        public static void AddUndoChange(Change change)
-        {
-            if (_lastChangeWasUndo == false && RedoStack.Count > 0) //Cleares RedoStack if las move wasn't redo or undo and if redo stack is greater than 0
-            {
-                RedoStack.Clear();
-            }
-            _lastChangeWasUndo = false;
-            UndoStack.Push(change);
-            Debug.WriteLine("UndoStackCount: " + UndoStack.Count + " RedoStackCount: " + RedoStack.Count);
-        }
-        /// <summary>
-        /// Adds property change to UndoStack
-        /// </summary>
-        /// <param name="property">Changed property name.</param>
-        /// <param name="oldValue">Old value of property.</param>
-        /// <param name="newValue">New value of property.</param>
-        /// <param name="undoDescription">Description of change.</param>
-        public static void AddUndoChange(string property, object oldValue, string undoDescription = "")
-        {
-            if(_lastChangeWasUndo == false && RedoStack.Count > 0) //Cleares RedoStack if las move wasn't redo or undo and if redo stack is greater than 0
-            {
-                RedoStack.Clear();
-            }            
-            _lastChangeWasUndo = false;
-            UndoStack.Push(new Change(property, oldValue, undoDescription));
-            Debug.WriteLine("UndoStackCount: " + UndoStack.Count + " RedoStackCount: " + RedoStack.Count);
-        }
-
-        /// <summary>
-        /// Sets top property in UndoStack to Old Value
-        /// </summary>
-        public static void Undo()
-        { 
-            _lastChangeWasUndo = true;
-            PropertyInfo propInfo = MainRoot.GetType().GetProperty(UndoStack.Peek().Property);
-            propInfo.SetValue(MainRoot, UndoStack.Peek().OldValue);
-            RedoStack.Push(UndoStack.Pop());
-        }
-
-        /// <summary>
-        /// Sets top property from RedoStack to old value
-        /// </summary>
-        public static void Redo() 
-        {
-            _lastChangeWasUndo = true;
-            PropertyInfo propinfo = MainRoot.GetType().GetProperty(RedoStack.Peek().Property);
-            propinfo.SetValue(MainRoot, RedoStack.Peek().NewValue);
-            UndoStack.Push(RedoStack.Pop());
-
-        }
-    }
-}
+using PixiEditor.Helpers;
+using PixiEditorDotNetCore3.Models.DataHolders;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Drawing.Printing;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media;
+
+namespace PixiEditorDotNetCore3.Models.Controllers
+{
+    public static class UndoManager
+    {
+        public static StackEx<Change> UndoStack { get; set; } = new StackEx<Change>();
+        public static StackEx<Change> RedoStack { get; set; } = new StackEx<Change>();
+        private static bool _stopRecording = false;
+        private static List<Change> _recordedChanges = new List<Change>();
+        private static bool _lastChangeWasUndo = false;
+        public static bool CanUndo
+        {
+            get
+            {
+                return UndoStack.Count > 0;
+            }
+        }
+        public static bool CanRedo
+        {
+            get
+            {
+                return RedoStack.Count > 0;
+            }
+        }
+
+        public static object MainRoot { get; set; }
+
+        /// <summary>
+        /// Sets object(root) in which undo properties are stored.
+        /// </summary>
+        /// <param name="root">Parent object.</param>
+        public static void SetMainRoot(object root)
+        {
+            MainRoot = root;
+        }
+
+        /// <summary>
+        /// Records changes, used to save multiple changes as one
+        /// </summary>
+        /// <param name="property">Record property name.</param>
+        /// <param name="oldValue">Old change value.</param>
+        /// <param name="newValue">New change value.</param>
+        /// <param name="undoDescription">Description of change.</param>
+        public static void RecordChanges(string property, object oldValue, string undoDescription = "")
+        {
+            if (_stopRecording == false)
+            {
+                if (_recordedChanges.Count >= 2)
+                {
+                    _recordedChanges.RemoveAt(_recordedChanges.Count - 1);
+                }
+                _recordedChanges.Add(new Change(property, oldValue, undoDescription));
+
+            }
+        }
+
+        /// <summary>
+        /// Stops recording changes and saves it as one.
+        /// </summary>
+        public static void StopRecording()
+        {
+            _stopRecording = true;
+            if (_recordedChanges.Count > 0)
+            {
+                Change changeToSave = _recordedChanges[0];
+                changeToSave.NewValue = _recordedChanges.Last().OldValue;
+                AddUndoChange(changeToSave);
+                _recordedChanges.Clear();
+            }
+            _stopRecording = false;
+        }
+
+        public static void AddUndoChange(Change change)
+        {
+            if (_lastChangeWasUndo == false && RedoStack.Count > 0) //Cleares RedoStack if las move wasn't redo or undo and if redo stack is greater than 0
+            {
+                RedoStack.Clear();
+            }
+            _lastChangeWasUndo = false;
+            UndoStack.Push(change);
+            Debug.WriteLine("UndoStackCount: " + UndoStack.Count + " RedoStackCount: " + RedoStack.Count);
+        }
+        /// <summary>
+        /// Adds property change to UndoStack
+        /// </summary>
+        /// <param name="property">Changed property name.</param>
+        /// <param name="oldValue">Old value of property.</param>
+        /// <param name="newValue">New value of property.</param>
+        /// <param name="undoDescription">Description of change.</param>
+        public static void AddUndoChange(string property, object oldValue, string undoDescription = "")
+        {
+            if (_lastChangeWasUndo == false && RedoStack.Count > 0) //Cleares RedoStack if las move wasn't redo or undo and if redo stack is greater than 0
+            {
+                RedoStack.Clear();
+            }
+            _lastChangeWasUndo = false;
+            UndoStack.Push(new Change(property, oldValue, undoDescription));
+            Debug.WriteLine("UndoStackCount: " + UndoStack.Count + " RedoStackCount: " + RedoStack.Count);
+        }
+
+        /// <summary>
+        /// Sets top property in UndoStack to Old Value
+        /// </summary>
+        public static void Undo()
+        {
+            _lastChangeWasUndo = true;
+            PropertyInfo propInfo = MainRoot.GetType().GetProperty(UndoStack.Peek().Property);
+            propInfo.SetValue(MainRoot, UndoStack.Peek().OldValue);
+            RedoStack.Push(UndoStack.Pop());
+        }
+
+        /// <summary>
+        /// Sets top property from RedoStack to old value
+        /// </summary>
+        public static void Redo()
+        {
+            _lastChangeWasUndo = true;
+            PropertyInfo propinfo = MainRoot.GetType().GetProperty(RedoStack.Peek().Property);
+            propinfo.SetValue(MainRoot, RedoStack.Peek().NewValue);
+            UndoStack.Push(RedoStack.Pop());
+
+        }
+    }
+}

+ 6 - 7
PixiEditorDotNetCore3/Models/Change.cs → PixiEditorDotNetCore3/Models/DataHolders/Change.cs

@@ -1,12 +1,11 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Runtime.Serialization;
+using System.Runtime.Serialization;
 using System.Text;
 using System.Threading.Tasks;
-using PixiEditorDotNetCore3.Models;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.DataHolders
 {
     [Serializable]
     public class Change
@@ -23,13 +22,13 @@ namespace PixiEditorDotNetCore3.Models
         {
             Property = property;
             OldValue = oldValue;
-            Description = description;
+            Description = description;
             NewValue = OldValue;
         }
 
-        public Change()
-        {
-           
+        public Change()
+        {
+
         }
 
     }

+ 60 - 60
PixiEditorDotNetCore3/Models/StackEx.cs → PixiEditorDotNetCore3/Models/DataHolders/StackEx.cs

@@ -1,60 +1,60 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PixiEditorDotNetCore3.Models
-{
-    public class StackEx<T>
-    {
-        public int Count
-        {
-            get { return items.Count; }
-        }
-
-        public T First
-        {
-            get { return items[0]; }
-        }
-
-        private List<T> items = new List<T>();
-
-        public void Clear()
-        {
-            items.Clear();
-        }
-
-        public T Peek()
-        {
-            return items[items.Count - 1];
-        }
-
-        public void Push(T item)
-        {
-            items.Add(item);
-        }
-
-        public T Pop()
-        {
-            if (items.Count > 0)
-            {
-                T temp = items[items.Count - 1];
-                items.RemoveAt(items.Count - 1);
-                return temp;
-            }
-            else
-                return default;
-        }
-
-        public void PushToBottom(T item)
-        {
-            items.Insert(0, item);
-        }
-
-        public void Remove(int itemAtPosition)
-        {
-            items.RemoveAt(itemAtPosition);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PixiEditorDotNetCore3.Models.DataHolders
+{
+    public class StackEx<T>
+    {
+        public int Count
+        {
+            get { return items.Count; }
+        }
+
+        public T First
+        {
+            get { return items[0]; }
+        }
+
+        private List<T> items = new List<T>();
+
+        public void Clear()
+        {
+            items.Clear();
+        }
+
+        public T Peek()
+        {
+            return items[items.Count - 1];
+        }
+
+        public void Push(T item)
+        {
+            items.Add(item);
+        }
+
+        public T Pop()
+        {
+            if (items.Count > 0)
+            {
+                T temp = items[items.Count - 1];
+                items.RemoveAt(items.Count - 1);
+                return temp;
+            }
+            else
+                return default;
+        }
+
+        public void PushToBottom(T item)
+        {
+            items.Insert(0, item);
+        }
+
+        public void Remove(int itemAtPosition)
+        {
+            items.RemoveAt(itemAtPosition);
+        }
+    }
+}

+ 60 - 60
PixiEditorDotNetCore3/Models/Tuple.cs → PixiEditorDotNetCore3/Models/DataHolders/Tuple.cs

@@ -1,60 +1,60 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace PixiEditorDotNetCore3.Models
-{
-    public class Tuple<T1, T2, T3> : IEquatable<Object>
-    {
-        public T1 Item1
-        {
-            get;
-            set;
-        }
-
-        public T2 Item2
-        {
-            get;
-            set;
-        }
-
-        public T3 Item3
-        {
-            get;
-            set;
-        }
-
-        public Tuple(T1 Item1, T2 Item2, T3 Item3)
-        {
-            this.Item1 = Item1;
-            this.Item2 = Item2;
-            this.Item3 = Item3;
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (obj == null || (obj as Tuple<T1, T2, T3>) == null) //if the object is null or the cast fails
-                return false;
-            else
-            {
-                Tuple<T1, T2, T3> tuple = (Tuple<T1, T2, T3>)obj;
-                return Item1.Equals(tuple.Item1) && Item2.Equals(tuple.Item2) && Item3.Equals(tuple.Item3);
-            }
-        }
-
-        public override int GetHashCode()
-        {
-            return Item1.GetHashCode() ^ Item2.GetHashCode() ^ Item3.GetHashCode();
-        }
-
-        public static bool operator ==(Tuple<T1, T2, T3> tuple1, Tuple<T1, T2, T3> tuple2)
-        {
-            return tuple1.Equals(tuple2);
-        }
-
-        public static bool operator !=(Tuple<T1, T2, T3> tuple1, Tuple<T1, T2, T3> tuple2)
-        {
-            return !tuple1.Equals(tuple2);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace PixiEditorDotNetCore3.Models.DataHolders
+{
+    public class Tuple<T1, T2, T3> : IEquatable<object>
+    {
+        public T1 Item1
+        {
+            get;
+            set;
+        }
+
+        public T2 Item2
+        {
+            get;
+            set;
+        }
+
+        public T3 Item3
+        {
+            get;
+            set;
+        }
+
+        public Tuple(T1 Item1, T2 Item2, T3 Item3)
+        {
+            this.Item1 = Item1;
+            this.Item2 = Item2;
+            this.Item3 = Item3;
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (obj == null || obj as Tuple<T1, T2, T3> == null) //if the object is null or the cast fails
+                return false;
+            else
+            {
+                Tuple<T1, T2, T3> tuple = (Tuple<T1, T2, T3>)obj;
+                return Item1.Equals(tuple.Item1) && Item2.Equals(tuple.Item2) && Item3.Equals(tuple.Item3);
+            }
+        }
+
+        public override int GetHashCode()
+        {
+            return Item1.GetHashCode() ^ Item2.GetHashCode() ^ Item3.GetHashCode();
+        }
+
+        public static bool operator ==(Tuple<T1, T2, T3> tuple1, Tuple<T1, T2, T3> tuple2)
+        {
+            return tuple1.Equals(tuple2);
+        }
+
+        public static bool operator !=(Tuple<T1, T2, T3> tuple1, Tuple<T1, T2, T3> tuple2)
+        {
+            return !tuple1.Equals(tuple2);
+        }
+    }
+}

+ 1 - 1
PixiEditorDotNetCore3/Models/CustomDialog.cs → PixiEditorDotNetCore3/Models/Dialogs/CustomDialog.cs

@@ -7,7 +7,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Dialogs
 {
     public abstract class CustomDialog : NotifyableObject
     {

+ 1 - 1
PixiEditorDotNetCore3/Models/ExportFileDialog.cs → PixiEditorDotNetCore3/Models/Dialogs/ExportFileDialog.cs

@@ -7,7 +7,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Dialogs
 {
     public class ExportFileDialog : CustomDialog
     {

+ 1 - 1
PixiEditorDotNetCore3/Models/ImportFileDialog.cs → PixiEditorDotNetCore3/Models/Dialogs/ImportFileDialog.cs

@@ -6,7 +6,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Dialogs
 {
     class ImportFileDialog : CustomDialog
     {

+ 1 - 1
PixiEditorDotNetCore3/Models/NewFileDialog.cs → PixiEditorDotNetCore3/Models/Dialogs/NewFileDialog.cs

@@ -7,7 +7,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Dialogs
 {
     public class NewFileDialog : CustomDialog
     {

+ 19 - 18
PixiEditorDotNetCore3/Models/Exporter.cs → PixiEditorDotNetCore3/Models/IO/Exporter.cs

@@ -10,9 +10,10 @@ using System.Windows.Controls;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using Microsoft.Win32;
+using PixiEditorDotNetCore3.Models.Dialogs;
 using PixiEditorDotNetCore3.Models.Enums;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.IO
 {
     public class Exporter
     {
@@ -24,23 +25,23 @@ namespace PixiEditorDotNetCore3.Models
         /// </summary>
         /// <param name="type">Type of file to be saved in.</param>
         /// <param name="imageToSave">Image to be saved as file.</param>
-        public static void Export(FileType type,Image imageToSave, Size fileDimensions)
+        public static void Export(FileType type, Image imageToSave, Size fileDimensions)
         {
-                ExportFileDialog info = new ExportFileDialog(fileDimensions);
-                //If OK on dialog has been clicked
-                if (info.ShowDialog() == true)
+            ExportFileDialog info = new ExportFileDialog(fileDimensions);
+            //If OK on dialog has been clicked
+            if (info.ShowDialog() == true)
+            {
+                //If sizes are incorrect
+                if (info.FileWidth < imageToSave.Width || info.FileHeight < imageToSave.Height)
                 {
-                    //If sizes are incorrect
-                    if(info.FileWidth < imageToSave.Width || info.FileHeight < imageToSave.Height)
-                    {
-                        MessageBox.Show("Incorrect height or width value", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
-                        return;
-                    }
-
-                    _savePath = info.FilePath;
-                    _fileDimensions = new Size(info.FileWidth, info.FileHeight);
-                    SaveAsPng(info.FilePath, (int)imageToSave.Width, (int)imageToSave.Height, info.FileHeight, info.FileWidth, imageToSave);
+                    MessageBox.Show("Incorrect height or width value", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+                    return;
                 }
+
+                _savePath = info.FilePath;
+                _fileDimensions = new Size(info.FileWidth, info.FileHeight);
+                SaveAsPng(info.FilePath, (int)imageToSave.Width, (int)imageToSave.Height, info.FileHeight, info.FileWidth, imageToSave);
+            }
         }
 
         /// <summary>
@@ -54,7 +55,7 @@ namespace PixiEditorDotNetCore3.Models
             {
                 SaveAsPng(_savePath, (int)imageToSave.Width, (int)imageToSave.Height, (int)_fileDimensions.Height, (int)_fileDimensions.Width, imageToSave);
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
@@ -74,7 +75,7 @@ namespace PixiEditorDotNetCore3.Models
             double dpi = 96d;
 
 
-            RenderTargetBitmap rtb = new RenderTargetBitmap(originalWidth * (exportWidth / originalWidth), originalHeight * (exportHeight/originalHeight), dpi, dpi, PixelFormats.Default);
+            RenderTargetBitmap rtb = new RenderTargetBitmap(originalWidth * (exportWidth / originalWidth), originalHeight * (exportHeight / originalHeight), dpi, dpi, PixelFormats.Default);
 
 
             DrawingVisual dv = new DrawingVisual();
@@ -99,7 +100,7 @@ namespace PixiEditorDotNetCore3.Models
             }
             catch (Exception err)
             {
-                System.Windows.MessageBox.Show(err.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
+                MessageBox.Show(err.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }

+ 2 - 2
PixiEditorDotNetCore3/Models/Importer.cs → PixiEditorDotNetCore3/Models/IO/Importer.cs

@@ -7,10 +7,10 @@ using System.Threading.Tasks;
 using System.Windows.Media.Imaging;
 using System.Windows.Media;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.IO
 {
     public class Importer : NotifyableObject
-    { 
+    {
         /// <summary>
         /// Imports image from path and resizes it to given dimensions
         /// </summary>

+ 103 - 103
PixiEditorDotNetCore3/Models/PixiFilesManager.cs → PixiEditorDotNetCore3/Models/IO/PixiFilesManager.cs

@@ -1,103 +1,103 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using Newtonsoft.Json;
-
-namespace PixiEditorDotNetCore3.Models
-{
-    public static class PixiFilesManager
-    {
-
-        public static string TempFolderPath
-        {
-            get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PixiEditor\Temp"); }
-        }
-
-        public static string RedoStackPath
-        {
-            get { return Path.Combine(TempFolderPath, @"RedoStack"); }
-        }
-
-        public static string UndoStackPath
-        {
-            get { return Path.Combine(TempFolderPath, @"UndoStack"); }
-        }
-
-        /// <summary>
-        /// Saves object to file on disk using binary formatter
-        /// </summary>
-        /// <param name="obj">Object to be saved</param>
-        public static void SaveObjectToJsonFile<T>(T obj, string fileName) where T : new()
-        {
-            try
-            {
-                SaveSerializedObjectToFile(obj, fileName);
-            }
-            catch (IOException ex)
-            {
-                Debug.WriteLine(ex.Message);
-            }
-        }
-
-
-        public static void RemoveFile(string path)
-        {
-            File.Delete(path);
-        }
-
-        /// <summary>
-        /// Removes all files from directory
-        /// </summary>
-        /// <param name="path"></param>
-        public static void ClearDirectory(string path)
-        {
-            string[] filesInDirectory = Directory.GetFiles(path);
-            for (int i = 0; i < filesInDirectory.Length; i++)
-            {
-                File.Delete(filesInDirectory[i]);
-            }
-        }
-
-        private static void SaveSerializedObjectToFile(object obj, string filename)
-        {
-            using (TextWriter writer = new StreamWriter(filename, false))
-            {
-                var contentsToWriteToFile = JsonConvert.SerializeObject(obj);
-                writer.Write(contentsToWriteToFile);
-            }
-        }
-
-        public static T ReadObjectFromFile<T>(string filePath) where T : new()
-        {
-            using (TextReader reader = new StreamReader(filePath))
-            {
-                var fileContent = reader.ReadToEnd();
-                return JsonConvert.DeserializeObject<T>(fileContent);
-            }
-        }
-
-        /// <summary>
-        /// Creates and cleares temp directories
-        /// </summary>
-        public static void InitializeTempDirectories()
-        {
-            CreateTempDirectories();
-            ClearTempDirectoriesContent();
-        }
-
-        private static void CreateTempDirectories()
-        {
-            Directory.CreateDirectory(TempFolderPath);
-            Directory.CreateDirectory(Path.Combine(TempFolderPath, "UndoStack"));
-            Directory.CreateDirectory(Path.Combine(TempFolderPath, "RedoStack"));
-        }
-
-        public static void ClearTempDirectoriesContent()
-        {
-            ClearDirectory(RedoStackPath);
-            ClearDirectory(UndoStackPath);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using Newtonsoft.Json;
+
+namespace PixiEditorDotNetCore3.Models.IO
+{
+    public static class PixiFilesManager
+    {
+
+        public static string TempFolderPath
+        {
+            get { return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PixiEditor\Temp"); }
+        }
+
+        public static string RedoStackPath
+        {
+            get { return Path.Combine(TempFolderPath, @"RedoStack"); }
+        }
+
+        public static string UndoStackPath
+        {
+            get { return Path.Combine(TempFolderPath, @"UndoStack"); }
+        }
+
+        /// <summary>
+        /// Saves object to file on disk using binary formatter
+        /// </summary>
+        /// <param name="obj">Object to be saved</param>
+        public static void SaveObjectToJsonFile<T>(T obj, string fileName) where T : new()
+        {
+            try
+            {
+                SaveSerializedObjectToFile(obj, fileName);
+            }
+            catch (IOException ex)
+            {
+                Debug.WriteLine(ex.Message);
+            }
+        }
+
+
+        public static void RemoveFile(string path)
+        {
+            File.Delete(path);
+        }
+
+        /// <summary>
+        /// Removes all files from directory
+        /// </summary>
+        /// <param name="path"></param>
+        public static void ClearDirectory(string path)
+        {
+            string[] filesInDirectory = Directory.GetFiles(path);
+            for (int i = 0; i < filesInDirectory.Length; i++)
+            {
+                File.Delete(filesInDirectory[i]);
+            }
+        }
+
+        private static void SaveSerializedObjectToFile(object obj, string filename)
+        {
+            using (TextWriter writer = new StreamWriter(filename, false))
+            {
+                var contentsToWriteToFile = JsonConvert.SerializeObject(obj);
+                writer.Write(contentsToWriteToFile);
+            }
+        }
+
+        public static T ReadObjectFromFile<T>(string filePath) where T : new()
+        {
+            using (TextReader reader = new StreamReader(filePath))
+            {
+                var fileContent = reader.ReadToEnd();
+                return JsonConvert.DeserializeObject<T>(fileContent);
+            }
+        }
+
+        /// <summary>
+        /// Creates and cleares temp directories
+        /// </summary>
+        public static void InitializeTempDirectories()
+        {
+            CreateTempDirectories();
+            ClearTempDirectoriesContent();
+        }
+
+        private static void CreateTempDirectories()
+        {
+            Directory.CreateDirectory(TempFolderPath);
+            Directory.CreateDirectory(Path.Combine(TempFolderPath, "UndoStack"));
+            Directory.CreateDirectory(Path.Combine(TempFolderPath, "RedoStack"));
+        }
+
+        public static void ClearTempDirectoriesContent()
+        {
+            ClearDirectory(RedoStackPath);
+            ClearDirectory(UndoStackPath);
+        }
+    }
+}

+ 2 - 2
PixiEditorDotNetCore3/Models/BitmapConverter.cs → PixiEditorDotNetCore3/Models/Images/BitmapConverter.cs

@@ -8,11 +8,11 @@ using System.Threading.Tasks;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Images
 {
     public static class BitmapConverter
     {
-        public static WriteableBitmap BytesToWriteableBitmap(int currentBitmapWidth, int currentBitmapHeight ,byte[] byteArray)
+        public static WriteableBitmap BytesToWriteableBitmap(int currentBitmapWidth, int currentBitmapHeight, byte[] byteArray)
         {
             WriteableBitmap bitmap = BitmapFactory.New(currentBitmapWidth, currentBitmapHeight);
             bitmap.FromByteArray(byteArray);

+ 1 - 1
PixiEditorDotNetCore3/Models/ImageGenerator.cs → PixiEditorDotNetCore3/Models/Images/ImageGenerator.cs

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Controls;
 using System.Windows.Media;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Images
 {
     public static class ImageGenerator
     {

+ 1 - 1
PixiEditorDotNetCore3/Models/BasicLayer.cs → PixiEditorDotNetCore3/Models/Layers/BasicLayer.cs

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
 using System.Windows.Controls;
 using PixiEditor.Helpers;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Layers
 {
     [Serializable]
     public class BasicLayer : NotifyableObject

+ 5 - 4
PixiEditorDotNetCore3/Models/Layer.cs → PixiEditorDotNetCore3/Models/Layers/Layer.cs

@@ -12,7 +12,7 @@ using System.Windows.Controls;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Layers
 {
     public class Layer : BasicLayer
     {
@@ -21,7 +21,8 @@ namespace PixiEditorDotNetCore3.Models
         public WriteableBitmap LayerBitmap
         {
             get { return _layerBitmap; }
-            set {
+            set
+            {
                 _layerBitmap = value;
                 RaisePropertyChanged("LayerBitmap");
             }
@@ -39,8 +40,8 @@ namespace PixiEditorDotNetCore3.Models
         public Layer(WriteableBitmap layerBitmap)
         {
             LayerBitmap = layerBitmap;
-            Width = (int) layerBitmap.Width;
-            Height = (int) layerBitmap.Height;
+            Width = (int)layerBitmap.Width;
+            Height = (int)layerBitmap.Height;
         }
 
         public void ApplyPixels(BitmapPixelChanges pixels, Color color)

+ 4 - 4
PixiEditorDotNetCore3/Models/LayerGenerator.cs → PixiEditorDotNetCore3/Models/Layers/LayerGenerator.cs

@@ -10,9 +10,9 @@ using System.Windows.Controls;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Layers
 {
-    public static class LayerGenerator 
+    public static class LayerGenerator
     {
         /// <summary>
         /// Generating useable layer with image and bitmap
@@ -40,8 +40,8 @@ namespace PixiEditorDotNetCore3.Models
         private static WriteableBitmap GenerateBitmap(int bitmapWidth, int imageHeight)
         {
             WriteableBitmap bitmap = BitmapFactory.New(bitmapWidth, imageHeight);
-            bitmap.Clear(Colors.Transparent);
+            bitmap.Clear(System.Windows.Media.Colors.Transparent);
             return bitmap;
-        }      
+        }
     }
 }

+ 9 - 9
PixiEditorDotNetCore3/Models/LightLayer.cs → PixiEditorDotNetCore3/Models/Layers/LightLayer.cs

@@ -4,11 +4,11 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Controls;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using PixiEditor.Helpers;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Layers
 {
     [Serializable]
     public class LightLayer : BasicLayer
@@ -40,14 +40,14 @@ namespace PixiEditorDotNetCore3.Models
             Height = width;
         }
 
-        public LightLayer()
-        {
-
+        public LightLayer()
+        {
+
         }
 
-        public static LightLayer Deserialize(object value)
-        {
-            return JsonConvert.DeserializeObject<LightLayer>(((JObject)value).ToString());
+        public static LightLayer Deserialize(object value)
+        {
+            return JsonConvert.DeserializeObject<LightLayer>(((JObject)value).ToString());
         }
 
     }

+ 1 - 1
PixiEditorDotNetCore3/Models/Coordinates.cs → PixiEditorDotNetCore3/Models/Position/Coordinates.cs

@@ -4,7 +4,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Position
 {
     public class Coordinates
     {

+ 6 - 4
PixiEditorDotNetCore3/Models/CoordinatesCalculator.cs → PixiEditorDotNetCore3/Models/Position/CoordinatesCalculator.cs

@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Text;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Position
 {
     public static class CoordinatesCalculator
     {
@@ -24,16 +24,18 @@ namespace PixiEditorDotNetCore3.Models
             }
             else
             {
-                x2 = startPosition.X + (((thickness - 1) / 2) + 1);
-                y2 = startPosition.Y + (((thickness - 1) / 2) + 1);
+                x2 = startPosition.X + (thickness - 1) / 2 + 1;
+                y2 = startPosition.Y + (thickness - 1) / 2 + 1;
                 x1 = x2 - thickness;
                 y1 = y2 - thickness;
             }
-            return new DoubleCords(new Coordinates(x1, y1), new Coordinates(x2, y2));
+            return new DoubleCords(new Coordinates(x1, y1), new Coordinates(x2 - 1, y2 - 1));
         }
 
         public static Coordinates[] RectangleToCoordinates(int x1, int y1, int x2, int y2)
         {
+            x2++;
+            y2++;
             List<Coordinates> coordinates = new List<Coordinates>();
             for (int y = y1; y < y1 + (y2 - y1); y++)
             {

+ 2 - 2
PixiEditorDotNetCore3/Models/DoubleCords.cs → PixiEditorDotNetCore3/Models/Position/DoubleCords.cs

@@ -4,13 +4,13 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Position
 {
     public class DoubleCords
     {
         public Coordinates Coords1 { get; set; }
         public Coordinates Coords2 { get; set; }
-        
+
         public DoubleCords(Coordinates cords1, Coordinates cords2)
         {
             Coords1 = cords1;

+ 3 - 9
PixiEditorDotNetCore3/Models/MousePositionConverter.cs → PixiEditorDotNetCore3/Models/Position/MousePositionConverter.cs

@@ -1,13 +1,7 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using PixiEditorDotNetCore3.Models.Layers;
 using System.Windows;
-using System.Windows.Input;
 
-namespace PixiEditorDotNetCore3.Models
+namespace PixiEditorDotNetCore3.Models.Position
 {
     public static class MousePositionConverter
     {
@@ -18,6 +12,6 @@ namespace PixiEditorDotNetCore3.Models
             int xCoord = (int)(mousePosition.X / baseLayer.Width);
             int yCoord = (int)(mousePosition.Y / baseLayer.Height);
             return new Coordinates(xCoord, yCoord);
-        }       
+        }
     }
 }

+ 3 - 2
PixiEditorDotNetCore3/Models/Tools/BitmapPixelChanges.cs

@@ -1,11 +1,12 @@
-using System;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;
 
 namespace PixiEditorDotNetCore3.Models.Tools
 {
-     public struct BitmapPixelChanges
+    public struct BitmapPixelChanges
     {
         public Coordinates[] ChangedCoordinates { get; set; }
         public Color PixelsColor { get; set; }

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/ShapeTool.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tool.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;

+ 0 - 0
PixiEditorDotNetCore3/Models/ToolManager.cs → PixiEditorDotNetCore3/Models/Tools/ToolManager.cs


+ 5 - 2
PixiEditorDotNetCore3/Models/Tools/Tools/BrightnessTool.cs

@@ -1,4 +1,7 @@
-using System.Windows.Input;
+using PixiEditorDotNetCore3.Models.Colors;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
@@ -23,7 +26,7 @@ namespace PixiEditorDotNetCore3.Models.Tools.Tools
         {
             PenTool pen = new PenTool();
             Color pixel = layer.LayerBitmap.GetPixel(coordinates.X, coordinates.Y);
-            Color newColor = ExColor.ChangeColorBrightness(System.Drawing.Color.FromArgb(pixel.R, pixel.G, pixel.B), correctionFactor);
+            Color newColor = ExColor.ChangeColorBrightness(Color.FromArgb(pixel.A,pixel.R, pixel.G, pixel.B), correctionFactor);
             return pen.Draw(coordinates, newColor, toolSize);
         }
     }

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/CircleTool.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;

+ 4 - 2
PixiEditorDotNetCore3/Models/Tools/Tools/EarserTool.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;
@@ -12,7 +14,7 @@ namespace PixiEditorDotNetCore3.Models.Tools.Tools
         public override BitmapPixelChanges Use(Layer layer, Coordinates startingCoords, Color color, int toolSize)
         {
             PenTool pen = new PenTool();
-            return pen.Draw(startingCoords, Colors.Transparent, toolSize);
+            return pen.Draw(startingCoords, System.Windows.Media.Colors.Transparent, toolSize);
         }
     }
 }

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/FloodFill.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/LineTool.cs

@@ -1,4 +1,6 @@
-using System.Windows.Media;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
 namespace PixiEditorDotNetCore3.Models.Tools.Tools

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/PenTool.cs

@@ -1,4 +1,6 @@
-using System;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System;
 using System.Collections.Generic;
 using System.Text;
 using System.Windows.Media;

+ 3 - 1
PixiEditorDotNetCore3/Models/Tools/Tools/RectangleTool.cs

@@ -1,4 +1,6 @@
-using System.Windows.Media;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
+using System.Windows.Media;
 using System.Windows.Media.Imaging;
 
 namespace PixiEditorDotNetCore3.Models.Tools.Tools

+ 2 - 0
PixiEditorDotNetCore3/Models/Tools/ToolsManager.cs

@@ -9,6 +9,8 @@ using PixiEditor.ViewModels;
 using System.Timers;
 using System.Windows.Threading;
 using System.Threading;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
 
 namespace PixiEditorDotNetCore3.Models.Tools
 {

+ 6 - 1
PixiEditorDotNetCore3/ViewModels/ViewModelMain.cs

@@ -1,7 +1,6 @@
 using PixiEditor.Helpers;
 using PixiEditorDotNetCore3.Models.Enums;
 using PixiEditorDotNetCore3.Models.Tools;
-using PixiEditorDotNetCore3.Models;
 using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
@@ -11,6 +10,12 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using PixiTools = PixiEditorDotNetCore3.Models.Tools.Tools;
+using PixiEditorDotNetCore3.Models.Controllers;
+using PixiEditorDotNetCore3.Models.Dialogs;
+using PixiEditorDotNetCore3.Models.Images;
+using PixiEditorDotNetCore3.Models.IO;
+using PixiEditorDotNetCore3.Models.Layers;
+using PixiEditorDotNetCore3.Models.Position;
 
 namespace PixiEditor.ViewModels
 {

+ 27 - 0
PixiEditorTests/WorkspaceTests/ColorsTests/ExtendedColorTests.cs

@@ -0,0 +1,27 @@
+using NUnit.Framework;
+using PixiEditorDotNetCore3.Models.Colors;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Media;
+
+namespace PixiEditorTests.WorkspaceTests.ColorsTests
+{
+    [TestFixture]
+    public class ExtendedColorTests
+    {
+        [TestCase()]
+        public void ChangeColorBrightnessIsNotTheSameTest()
+        {
+            Color newColor = ExColor.ChangeColorBrightness(Colors.White, -0.1f);
+            Assert.AreNotEqual(Colors.White, newColor);
+        }
+
+        [TestCase()]
+        public void ChangeColorBrightnessNewValueTest()
+        {
+            Color newColor = ExColor.ChangeColorBrightness(Colors.White, -1f);
+            Assert.AreEqual(Colors.Black, newColor);
+        }
+    }
+}

+ 1 - 1
PixiEditorTests/WorkspaceTests/ImageGeneratorTests.cs

@@ -1,5 +1,5 @@
 using NUnit.Framework;
-using PixiEditorDotNetCore3.Models;
+using PixiEditorDotNetCore3.Models.Images;
 using System;
 using System.Collections.Generic;
 using System.Text;

+ 25 - 3
PixiEditorTests/WorkspaceTests/ToolsTests/CoordinatesCalculatorTests.cs

@@ -1,5 +1,5 @@
 using NUnit.Framework;
-using PixiEditorDotNetCore3.Models;
+using PixiEditorDotNetCore3.Models.Position;
 using PixiEditorDotNetCore3.Models.Tools.Tools;
 using System;
 using System.Collections.Generic;
@@ -10,11 +10,33 @@ namespace PixiEditorTests.WorkspaceTests.ToolsTests
     [TestFixture]
     public class CoordinatesCalculatorTests
     {
-        [TestCase(0,0,2,2, ExpectedResult = 9)]
-        [TestCase(0,0,10,10, ExpectedResult = 121)]
+        [TestCase(0, 0, 2, 2, ExpectedResult = 9)]
+        [TestCase(0, 0, 10, 10, ExpectedResult = 121)]
         public int RectangleToCoordinatesAmountTest(int x1, int y1, int x2, int y2)
         {
             return CoordinatesCalculator.RectangleToCoordinates(x1, y1, x2, y2).Length;
         }
+
+        [TestCase()]
+        public void CalculateSquareEvenThicknessCenterTest()
+        {
+            DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 4);
+
+            Assert.AreEqual(1, cords.Coords1.X);
+            Assert.AreEqual(1, cords.Coords1.Y);
+            Assert.AreEqual(4, cords.Coords2.X);
+            Assert.AreEqual(4, cords.Coords2.Y);
+        }
+
+        [TestCase()]
+        public void CalculateSquareOddThicknessCenterTest()
+        {
+            DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 3);
+
+            Assert.AreEqual(2, cords.Coords1.X);
+            Assert.AreEqual(2, cords.Coords1.Y);
+            Assert.AreEqual(4, cords.Coords2.X);
+            Assert.AreEqual(4, cords.Coords2.Y);
+        }
     }
 }