From 2c0ac2979a97a4c0eb5ed0428009c3f6aad1c091 Mon Sep 17 00:00:00 2001 From: maxluli Date: Thu, 16 Jun 2022 14:30:10 +0200 Subject: [PATCH] Updated Bezier pencil and the sample box is now much better because it actually simulate the PaintTool --- Paint_2/BezierPencil.cs | 17 ++++---- Paint_2/DotPencil.cs | 2 +- Paint_2/Form1.Designer.cs | 42 +++++++++---------- Paint_2/Form1.cs | 86 +++++++++++++++++++++++++++++++++++---- Paint_2/Project.cs | 12 ++++++ 5 files changed, 121 insertions(+), 38 deletions(-) diff --git a/Paint_2/BezierPencil.cs b/Paint_2/BezierPencil.cs index f38ce1e..0d60104 100644 --- a/Paint_2/BezierPencil.cs +++ b/Paint_2/BezierPencil.cs @@ -78,17 +78,16 @@ namespace Paint_2 } } if (points.Count > 0) - { - - for (int i = 1; i <= points.Count; i++) + { + for (int i = 0; i < points.Count; i++) { - pointSize = new Size(Widths[0], Widths[0]); - gr.FillEllipse(new SolidBrush(Colors[i - 1]), new Rectangle(new Point(points[i - 1].X - pointSize.Width / 2, points[i - 1].Y - pointSize.Height / 2), pointSize)); - ContinuousBezierGenerator(gr, points, i); + pointSize = new Size(Widths[0]/2, Widths[0]/2); + gr.FillEllipse(new SolidBrush(Colors[i]), new Rectangle(new Point(points[i].X - pointSize.Width / 2, points[i].Y - pointSize.Height / 2), pointSize)); + ContinuousBezierGenerator(gr, points, i, Colors[Colors.Count-1], Widths[Widths.Count -1]); } } } - private void ContinuousBezierGenerator(Graphics gr, List points, int i) + private void ContinuousBezierGenerator(Graphics gr, List points, int i,Color color,int width) { if (points.Count >= 4 && points.Count % 2 == 0) { @@ -100,7 +99,7 @@ namespace Paint_2 while (WorkingList.Count != 1) { - if (WorkingList.Count > 2) + if (WorkingList.Count > 1) { for (int pos = 0; pos < WorkingList.Count - 1; pos++) { @@ -114,7 +113,7 @@ namespace Paint_2 WorkingList = new List(DumpList); DumpList = new List(); } - gr.FillEllipse(new SolidBrush(GetRandomColor()), new Rectangle(WorkingList[0].X - Widths[0] / 2, WorkingList[0].Y - Widths[0] / 2, Widths[0], Widths[0])); + gr.FillEllipse(new SolidBrush(color), new Rectangle(WorkingList[0].X - Widths[0] / 2, WorkingList[0].Y - Widths[0] / 2, width, width)); } } } diff --git a/Paint_2/DotPencil.cs b/Paint_2/DotPencil.cs index 847a132..a6f061c 100644 --- a/Paint_2/DotPencil.cs +++ b/Paint_2/DotPencil.cs @@ -15,7 +15,7 @@ namespace Paint_2 { public class DotPencil : PaintTool { - const int POST_PROCESSING_PRECISION = 3; + const int POST_PROCESSING_PRECISION = 1; private List> _drawings; private List> _drawingsRedo; diff --git a/Paint_2/Form1.Designer.cs b/Paint_2/Form1.Designer.cs index 330f00b..823ed42 100644 --- a/Paint_2/Form1.Designer.cs +++ b/Paint_2/Form1.Designer.cs @@ -90,7 +90,7 @@ this.tbxProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxProjectName.Font = new System.Drawing.Font("Verdana", 15F); this.tbxProjectName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.tbxProjectName.Location = new System.Drawing.Point(2, 3); + this.tbxProjectName.Location = new System.Drawing.Point(2, 4); this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2); this.tbxProjectName.Name = "tbxProjectName"; this.tbxProjectName.Size = new System.Drawing.Size(225, 32); @@ -102,7 +102,7 @@ this.btnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnSave.Location = new System.Drawing.Point(231, 2); + this.btnSave.Location = new System.Drawing.Point(231, 3); this.btnSave.Margin = new System.Windows.Forms.Padding(2); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(54, 33); @@ -129,7 +129,7 @@ this.btnSaveCopy.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnSaveCopy.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnSaveCopy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnSaveCopy.Location = new System.Drawing.Point(289, 2); + this.btnSaveCopy.Location = new System.Drawing.Point(289, 3); this.btnSaveCopy.Margin = new System.Windows.Forms.Padding(2); this.btnSaveCopy.Name = "btnSaveCopy"; this.btnSaveCopy.Size = new System.Drawing.Size(92, 33); @@ -166,7 +166,7 @@ this.btnLoadFile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnLoadFile.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnLoadFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnLoadFile.Location = new System.Drawing.Point(385, 2); + this.btnLoadFile.Location = new System.Drawing.Point(385, 3); this.btnLoadFile.Margin = new System.Windows.Forms.Padding(2); this.btnLoadFile.Name = "btnLoadFile"; this.btnLoadFile.Size = new System.Drawing.Size(96, 33); @@ -190,7 +190,7 @@ // this.lblHeight.AutoSize = true; this.lblHeight.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.lblHeight.Location = new System.Drawing.Point(3, 33); + this.lblHeight.Location = new System.Drawing.Point(3, 38); this.lblHeight.Name = "lblHeight"; this.lblHeight.Size = new System.Drawing.Size(53, 14); this.lblHeight.TabIndex = 34; @@ -299,7 +299,7 @@ this.nupPencilWidth.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupPencilWidth.Font = new System.Drawing.Font("Cascadia Code", 15F); this.nupPencilWidth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.nupPencilWidth.Location = new System.Drawing.Point(126, 166); + this.nupPencilWidth.Location = new System.Drawing.Point(134, 166); this.nupPencilWidth.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.nupPencilWidth.Maximum = new decimal(new int[] { 255, @@ -307,7 +307,7 @@ 0, 0}); this.nupPencilWidth.Name = "nupPencilWidth"; - this.nupPencilWidth.Size = new System.Drawing.Size(63, 27); + this.nupPencilWidth.Size = new System.Drawing.Size(55, 27); this.nupPencilWidth.TabIndex = 17; this.nupPencilWidth.Value = new decimal(new int[] { 10, @@ -322,7 +322,7 @@ this.btnColorHistory4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnColorHistory4.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnColorHistory4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnColorHistory4.Location = new System.Drawing.Point(3, 2); + this.btnColorHistory4.Location = new System.Drawing.Point(3, 3); this.btnColorHistory4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnColorHistory4.Name = "btnColorHistory4"; this.btnColorHistory4.Size = new System.Drawing.Size(36, 33); @@ -336,7 +336,7 @@ this.btnColorHistory3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnColorHistory3.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnColorHistory3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnColorHistory3.Location = new System.Drawing.Point(45, 2); + this.btnColorHistory3.Location = new System.Drawing.Point(45, 3); this.btnColorHistory3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnColorHistory3.Name = "btnColorHistory3"; this.btnColorHistory3.Size = new System.Drawing.Size(36, 33); @@ -350,7 +350,7 @@ this.btnColorHistory2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnColorHistory2.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnColorHistory2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnColorHistory2.Location = new System.Drawing.Point(87, 2); + this.btnColorHistory2.Location = new System.Drawing.Point(87, 3); this.btnColorHistory2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnColorHistory2.Name = "btnColorHistory2"; this.btnColorHistory2.Size = new System.Drawing.Size(36, 33); @@ -364,7 +364,7 @@ this.btnColorHistory1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnColorHistory1.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnColorHistory1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnColorHistory1.Location = new System.Drawing.Point(129, 2); + this.btnColorHistory1.Location = new System.Drawing.Point(129, 3); this.btnColorHistory1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnColorHistory1.Name = "btnColorHistory1"; this.btnColorHistory1.Size = new System.Drawing.Size(36, 33); @@ -377,9 +377,9 @@ this.btnClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnClear.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.btnClear.Font = new System.Drawing.Font("Cascadia Code", 10.2F); + this.btnClear.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnClear.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnClear.Location = new System.Drawing.Point(6, 33); + this.btnClear.Location = new System.Drawing.Point(6, 30); this.btnClear.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnClear.Name = "btnClear"; this.btnClear.Size = new System.Drawing.Size(169, 24); @@ -421,7 +421,7 @@ this.pbxSample.Location = new System.Drawing.Point(6, 166); this.pbxSample.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbxSample.Name = "pbxSample"; - this.pbxSample.Size = new System.Drawing.Size(117, 59); + this.pbxSample.Size = new System.Drawing.Size(122, 64); this.pbxSample.TabIndex = 35; this.pbxSample.TabStop = false; // @@ -442,7 +442,7 @@ this.btnEyeDrop.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnEyeDrop.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.btnEyeDrop.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnEyeDrop.Location = new System.Drawing.Point(283, 2); + this.btnEyeDrop.Location = new System.Drawing.Point(283, 3); this.btnEyeDrop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnEyeDrop.Name = "btnEyeDrop"; this.btnEyeDrop.Size = new System.Drawing.Size(104, 33); @@ -457,7 +457,7 @@ this.btnRandomColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnRandomColor.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.btnRandomColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnRandomColor.Location = new System.Drawing.Point(393, 2); + this.btnRandomColor.Location = new System.Drawing.Point(393, 3); this.btnRandomColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnRandomColor.Name = "btnRandomColor"; this.btnRandomColor.Size = new System.Drawing.Size(108, 33); @@ -472,7 +472,7 @@ this.btnColorPicker.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnColorPicker.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.btnColorPicker.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnColorPicker.Location = new System.Drawing.Point(171, 2); + this.btnColorPicker.Location = new System.Drawing.Point(171, 3); this.btnColorPicker.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnColorPicker.Name = "btnColorPicker"; this.btnColorPicker.Size = new System.Drawing.Size(106, 33); @@ -485,9 +485,9 @@ // this.btnRedo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnRedo.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.btnRedo.Font = new System.Drawing.Font("Cascadia Code", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnRedo.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnRedo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnRedo.Location = new System.Drawing.Point(3, 5); + this.btnRedo.Location = new System.Drawing.Point(6, 4); this.btnRedo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnRedo.Name = "btnRedo"; this.btnRedo.Size = new System.Drawing.Size(80, 23); @@ -500,9 +500,9 @@ // this.btnUndo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnUndo.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.btnUndo.Font = new System.Drawing.Font("Cascadia Code", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnUndo.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnUndo.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); - this.btnUndo.Location = new System.Drawing.Point(92, 5); + this.btnUndo.Location = new System.Drawing.Point(95, 4); this.btnUndo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnUndo.Name = "btnUndo"; this.btnUndo.Size = new System.Drawing.Size(80, 23); diff --git a/Paint_2/Form1.cs b/Paint_2/Form1.cs index 3cfd00e..20b6780 100644 --- a/Paint_2/Form1.cs +++ b/Paint_2/Form1.cs @@ -104,12 +104,16 @@ namespace Paint_2 btnHoveringColor.BackColor = HoveringColor; List colorHistory = Project.GetLayerColorHistory(SelectedLayers, 4); + btnColorHistory1.BackColor = colorHistory[0]; btnColorHistory1.ForeColor = colorHistory[0]; + btnColorHistory2.BackColor = colorHistory[1]; btnColorHistory2.ForeColor = colorHistory[1]; + btnColorHistory3.BackColor = colorHistory[2]; btnColorHistory3.ForeColor = colorHistory[2]; + btnColorHistory4.BackColor = colorHistory[3]; btnColorHistory4.ForeColor = colorHistory[3]; @@ -139,8 +143,74 @@ namespace Paint_2 { Bitmap map = new Bitmap(size.Width, size.Height); Graphics gr = Graphics.FromImage(map); - gr.DrawLine(new Pen(Project.GetCurrentToolColor(SelectedLayers), Project.GetCurrentToolWidth(SelectedLayers)), new Point(0, 0), new Point(size.Width, size.Height)); + if (Project.GetCurrentTool(SelectedLayers) != null) + { + PaintTool currentTool = (PaintTool)Project.GetCurrentTool(SelectedLayers).Clone(); + //Would have loved to use a switch case but I cant + if (currentTool is Pencil) + { + Pencil pencil = currentTool as Pencil; + pencil.Start(Project.GetCurrentToolColor(SelectedLayers), Project.GetCurrentToolWidth(SelectedLayers)); + pencil.Add(new Point(0, size.Height)); + pencil.Add(new Point(size.Width, 0)); + pencil.Stop(); + pencil.Paint(map); + } + else + { + if (currentTool is DotPencil) + { + DotPencil pencil = currentTool as DotPencil; + pencil.Start(Project.GetCurrentToolColor(SelectedLayers), Project.GetCurrentToolWidth(SelectedLayers)); + int precision = 5; + for (int i = 0; i <= precision; i++) + { + Point newPoint = new Point(i * (size.Width / precision), size.Height - (i * (size.Height / precision))); + pencil.Add(newPoint); + } + pencil.Stop(); + pencil.Paint(map); + } + else + { + if (currentTool is BezierPencil) + { + BezierPencil pencil = currentTool as BezierPencil; + Color paint_tool_color = Project.GetCurrentToolColor(SelectedLayers); + int paint_tool_width = Project.GetCurrentToolWidth(SelectedLayers); + + Point p1 = new Point(0 - paint_tool_width / 2, 0 - paint_tool_width / 2); + Point p2 = new Point(0 - paint_tool_width / 2, size.Height + paint_tool_width / 2); + Point p3 = new Point(size.Width / 2 - paint_tool_width / 2,size.Height + paint_tool_width / 2); + Point p4 = new Point(size.Width / 2 - paint_tool_width / 2, 0 - paint_tool_width/2); + Point p5 = new Point(size.Width + paint_tool_width / 2, 0 - paint_tool_width / 2); + Point p6 = new Point(size.Width + paint_tool_width / 2, size.Height + paint_tool_width / 2); + // I KNOW THIS IS HARD CODED BUT ITS ONLY PURPOSE IS TO BE PRETTY so it does'nt matter + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p1); + pencil.Stop(); + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p2); + pencil.Stop(); + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p3); + pencil.Stop(); + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p4); + pencil.Stop(); + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p5); + pencil.Stop(); + pencil.Start(paint_tool_color, paint_tool_width); + pencil.Add(p6); + pencil.Stop(); + pencil.Paint(map); + } + } + } + } + //gr.DrawLine(new Pen(Project.GetCurrentToolColor(SelectedLayers), Project.GetCurrentToolWidth(SelectedLayers)), new Point(0, 0), new Point(size.Width, size.Height)); return map; } private Color GetHoverColor() @@ -191,6 +261,8 @@ namespace Paint_2 { int toolId = lsbTools.SelectedIndex; Project.ChangeTool(SelectedLayers, toolId); + //Yeah that is a little janky but I just want to refresh the tool + nupPencilWidth_ValueChanged(sender,e); RefreshUi(); } @@ -244,7 +316,7 @@ namespace Paint_2 { LayersToRemove.Add(layer); } - for (int id = layersCount -1; id >= 0; id--) + for (int id = layersCount - 1; id >= 0; id--) { if (Project.RemoveLayer(LayersToRemove[id])) { @@ -253,7 +325,7 @@ namespace Paint_2 else { Console.WriteLine("Could not delete the layer"); - } + } } DisplayLayers(); RefreshUi(); @@ -270,7 +342,7 @@ namespace Paint_2 int Yoffset = 10; int Xoffset = 10; float fontSize = 10; - Size blocSize = new Size(pnlLayers.Width,pnlLayers.Height/6); + Size blocSize = new Size(pnlLayers.Width, pnlLayers.Height / 6); int blocsCount = 0; int btnWidth = (int)(blocSize.Width / 2.7); int labelWidth = (int)(blocSize.Width / 3.0); @@ -287,13 +359,13 @@ namespace Paint_2 //LABEL LAYER NAME Label lblName = new Label(); //Style - lblName.Name = "lblLayer"+layer.Id; - lblName.Font = new Font("Arial",fontSize); + lblName.Name = "lblLayer" + layer.Id; + lblName.Font = new Font("Arial", fontSize); lblName.AutoSize = false; lblName.Width = labelWidth; lblName.Text = layer.Name; lblName.BackColor = Color.Transparent; - lblName.Location = new Point(0,blocsCount * blocSize.Height + Yoffset); + lblName.Location = new Point(0, blocsCount * blocSize.Height + Yoffset); //Style //Behaviour pnlLayers.Controls.Add(lblName); diff --git a/Paint_2/Project.cs b/Paint_2/Project.cs index c623f74..deeb6e7 100644 --- a/Paint_2/Project.cs +++ b/Paint_2/Project.cs @@ -282,6 +282,18 @@ namespace Paint_2 layer.Clear(); } } + public PaintTool GetCurrentTool(List selectedLayers) + { + if (Layers.Count == 0 || selectedLayers.Count == 0) + { + return null; + } + else + { + Sketch CurrentLayer = FindSketch(Layers, selectedLayers[0]); + return CurrentLayer.CurrentTool; + } + } public Color GetCurrentToolColor(List selectedLayers) { if (Layers.Count == 0 || selectedLayers.Count == 0)