diff --git a/Domain/BigFrameLayerRenderResult.cs b/Domain/BigFrameLayerRenderResult.cs new file mode 100644 index 0000000..bf06a08 --- /dev/null +++ b/Domain/BigFrameLayerRenderResult.cs @@ -0,0 +1,14 @@ +using Domain.Abstractions; + +namespace Domain; + +public class FramePartRenderResult +{ + public uint Row { get; set; } + public uint Column { get; set; } + public uint FrameSizeX { get; set; } + public uint FrameSizeY { get; set; } + // или пиксели? + + public string Frame { get; set; } +} \ No newline at end of file diff --git a/Domain/ConcreteLayers/Layer1.cs b/Domain/ConcreteLayers/Layer1.cs new file mode 100644 index 0000000..e69de29 diff --git a/Domain/ConsoleImageDrawer.cs b/Domain/ConsoleImageDrawer.cs new file mode 100644 index 0000000..85177f0 --- /dev/null +++ b/Domain/ConsoleImageDrawer.cs @@ -0,0 +1,77 @@ +using System; +namespace Domain; + +public class ConsoleImageDrawer +{ + private char[,]? _image; // Изображение хранится внутри класса + + // 1. Нарисовать изображение + public void DrawImage(char[,] image) + { + Console.Clear(); + _image = image; + for (int i = 0; i < _image.GetLength(0); i++) + { + for (int j = 0; j < _image.GetLength(1); j++) + { + Console.SetCursorPosition(j, i); + Console.Write(_image[i, j]); + } + } + } + + // 2. Заменить фон в указанной области на цвет + public void SetBackgroundColor(int startRow, int startCol, int height, int width, ConsoleColor color) + { + if (_image == null) + { + Console.Clear(); + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Image is not set"); + Console.ForegroundColor = ConsoleColor.Black; + return; + } + Console.BackgroundColor = color; + for (int i = startRow; i < Math.Min(startRow + height, _image.GetLength(0)); i++) + { + for (int j = startCol; j < Math.Min(startCol + width, _image.GetLength(1)); j++) + { + Console.SetCursorPosition(j, i); + Console.Write(_image[i, j]); + } + } + Console.ResetColor(); // Сброс цвета + } + + // 3. Отменить фон (вернуть черный) + public void ResetBackgroundColor(int startRow, int startCol, int height, int width) + { + SetBackgroundColor(startRow, startCol, height, width, ConsoleColor.Black); + } + + // 4. Изменить цвет указанного символа + public void SetCharacterColor(int row, int col, ConsoleColor foregroundColor) + { + if (_image == null) + { + Console.Clear(); + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Image is not set"); + Console.ForegroundColor = ConsoleColor.Black; + return; + } + if (row >= 0 && row < _image.GetLength(0) && col >= 0 && col < _image.GetLength(1)) + { + Console.SetCursorPosition(col, row); + Console.ForegroundColor = foregroundColor; + Console.Write(_image[row, col]); + Console.ResetColor(); // Сброс цвета + } + } + + // 5. Стереть изображение + public void ClearImage() + { + Console.Clear(); + } +} diff --git a/Domain/Abstractions/ILayer.cs b/Domain/ILayer.cs similarity index 100% rename from Domain/Abstractions/ILayer.cs rename to Domain/ILayer.cs diff --git a/Domain/RenderConveyerBelt.cs b/Domain/RenderConveyerBelt.cs new file mode 100644 index 0000000..e69de29 diff --git a/Domain/RenderResult.cs b/Domain/RenderResult.cs new file mode 100644 index 0000000..8e13d18 --- /dev/null +++ b/Domain/RenderResult.cs @@ -0,0 +1,6 @@ +namespace Domain.Abstractions; + +public class RenderResult +{ + public List<> +} \ No newline at end of file diff --git a/Make3.Renderer/test1.txt b/Make3.Renderer/test1.txt new file mode 100644 index 0000000..628ff00 --- /dev/null +++ b/Make3.Renderer/test1.txt @@ -0,0 +1,26 @@ + + + + + .:^. ::. + .:~77??: !??7!^: + :!7??????: !??????7~. + :7?????????: !?????????~. + .!???????????: !???????????^ + .7????????????: !????????????~ + .7?????????????: !?????????????~ + !??????????????: !??????????????: + .???????????????: !??????????????! + ^???????????????: !??????????????7 + :???????????????~ .7??????????????7 + .????????????????~. .:7???????????????! + ~?????????????????77!7??????????????????. + 7?????????????????????????????????????^ + .7J??????????????????????????????????^ + ~?J?????????????????????????????J7: + .!?JJ???????????????????????JJ7^ + .~7?JJJ???????????????JJJ?!: + .^!7???JJJJJJJJ????7~:. + ..:^^~~~~~^^:. + + diff --git a/Make3.Renderer/test2-mask.txt b/Make3.Renderer/test2-mask.txt new file mode 100644 index 0000000..e69de29 diff --git a/Make3.Renderer/test2.txt b/Make3.Renderer/test2.txt new file mode 100644 index 0000000..e69de29