diff --git a/Paint_2/BezierPencil.cs b/Paint_2/BezierPencil.cs index 9181f04..aa02b57 100644 --- a/Paint_2/BezierPencil.cs +++ b/Paint_2/BezierPencil.cs @@ -1,11 +1,15 @@ -using System; +/// file: BezierPencil.cs +/// Author: Maxime Rohmer +/// Brief: A unique tool that draws Bezier curves +/// Version: 0.1.0 +/// Date: 08/06/2022 + +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; -//[DEBUG] -using System.Windows.Forms; namespace Paint_2 { diff --git a/Paint_2/ColorPicker.Designer.cs b/Paint_2/ColorPicker.Designer.cs index a2e2250..0db12e2 100644 --- a/Paint_2/ColorPicker.Designer.cs +++ b/Paint_2/ColorPicker.Designer.cs @@ -70,6 +70,7 @@ this.pbxSelectedColor.Size = new System.Drawing.Size(100, 100); this.pbxSelectedColor.TabIndex = 4; this.pbxSelectedColor.TabStop = false; + this.pbxSelectedColor.Click += new System.EventHandler(this.pbxSelectedColor_Click); // // nupRed // @@ -226,6 +227,7 @@ this.Controls.Add(this.nupRed); this.Controls.Add(this.pbxSelectedColor); this.Controls.Add(this.pbxColor); + this.DoubleBuffered = true; this.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; diff --git a/Paint_2/ColorPicker.cs b/Paint_2/ColorPicker.cs index c858a45..7a15069 100644 --- a/Paint_2/ColorPicker.cs +++ b/Paint_2/ColorPicker.cs @@ -1,4 +1,10 @@ -using System; +/// file: ColorPicker.cs +/// Author: Maxime Rohmer +/// Brief: Class that is controlling the color usage +/// Version: 0.1.0 +/// Date: 06/08/2022 + +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -60,7 +66,17 @@ namespace Paint_2 } } } - + Rectangle rect; + if (vertical) + { + rect = new Rectangle(0, SelectedColor.R, size.Width / 20, size.Height); + } + else + { + rect = new Rectangle(SelectedColor.R, 0, size.Width / 20, size.Height); + } + gr.FillRectangle(new SolidBrush(Color.FromArgb(214, 214, 214)), rect); + gr.DrawRectangle(new Pen(Color.FromArgb(31, 31, 31)), rect); return map; } private Bitmap RefreshGammaLevel(Size size, bool vertical) @@ -71,7 +87,6 @@ namespace Paint_2 { for (int y = 0; y < size.Height; y++) { - //map.SetPixel(x, y, Color.FromArgb(y, SelectedColor.R, SelectedColor.G, SelectedColor.B)); if (vertical) { map.SetPixel(x, y, Color.FromArgb(y, y, y, y)); @@ -82,7 +97,17 @@ namespace Paint_2 } } } - + Rectangle rect; + if (vertical) + { + rect = new Rectangle(0, SelectedColor.A, size.Width,size.Height / 20); + } + else + { + rect = new Rectangle(SelectedColor.A, 0, size.Width / 20, size.Height); + } + gr.FillRectangle(new SolidBrush(Color.FromArgb(214, 214, 214)), rect); + gr.DrawRectangle(new Pen(Color.FromArgb(31, 31, 31)), rect); return map; } private Bitmap RefreshSelectedColorMap(Size size) @@ -111,7 +136,6 @@ namespace Paint_2 private void tbrRedLevel_Scroll(object sender, EventArgs e) { - //RedLevel = tbrRedLevel.Value; RefreshUi(); } @@ -229,5 +253,10 @@ namespace Paint_2 { RefreshUi(); } + + private void pbxSelectedColor_Click(object sender, EventArgs e) + { + main.sketch.ChangePaintToolColor(SelectedColor); + } } } diff --git a/Paint_2/DotPencil.cs b/Paint_2/DotPencil.cs index f3e6524..da61500 100644 --- a/Paint_2/DotPencil.cs +++ b/Paint_2/DotPencil.cs @@ -2,7 +2,8 @@ /// Author: Maxime Rohmer /// Brief: A variant of the default tool /// Version: 0.1.0 -/// Date: 25/05/2022 +/// Date: 08/06/2022 + using System; using System.Collections.Generic; using System.Linq; diff --git a/Paint_2/Form1.Designer.cs b/Paint_2/Form1.Designer.cs index 994c0b6..666d37a 100644 --- a/Paint_2/Form1.Designer.cs +++ b/Paint_2/Form1.Designer.cs @@ -60,12 +60,12 @@ this.btnClear = new System.Windows.Forms.Button(); this.label13 = new System.Windows.Forms.Label(); this.panelTools = new System.Windows.Forms.Panel(); + this.btnColorPicker = new System.Windows.Forms.Button(); this.btnRedo = new System.Windows.Forms.Button(); this.btnUndo = new System.Windows.Forms.Button(); this.btnRandomColor = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.lsbTools = new System.Windows.Forms.ListBox(); - this.btnColorPicker = new System.Windows.Forms.Button(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); ((System.ComponentModel.ISupportInitialize)(this.canvas)).BeginInit(); this.panelFile.SuspendLayout(); @@ -84,7 +84,7 @@ this.tbxProjectName.Location = new System.Drawing.Point(10, 24); this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.tbxProjectName.Name = "tbxProjectName"; - this.tbxProjectName.Size = new System.Drawing.Size(230, 23); + this.tbxProjectName.Size = new System.Drawing.Size(230, 27); this.tbxProjectName.TabIndex = 0; this.tbxProjectName.Text = "Untitled Project"; // @@ -133,7 +133,7 @@ this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 22); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(88, 18); + this.label1.Size = new System.Drawing.Size(110, 22); this.label1.TabIndex = 5; this.label1.Text = "Dimensions"; // @@ -142,7 +142,7 @@ this.lblSelectedColor.AutoSize = true; this.lblSelectedColor.Location = new System.Drawing.Point(6, 22); this.lblSelectedColor.Name = "lblSelectedColor"; - this.lblSelectedColor.Size = new System.Drawing.Size(232, 18); + this.lblSelectedColor.Size = new System.Drawing.Size(290, 22); this.lblSelectedColor.TabIndex = 1; this.lblSelectedColor.Text = "Hex:FFFFFF R:255 G:255 B:255"; // @@ -164,7 +164,7 @@ this.label10.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label10.Location = new System.Drawing.Point(6, 0); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(40, 18); + this.label10.Size = new System.Drawing.Size(50, 22); this.label10.TabIndex = 29; this.label10.Text = "File"; // @@ -185,7 +185,7 @@ this.lblHeight.AutoSize = true; this.lblHeight.Location = new System.Drawing.Point(100, 24); this.lblHeight.Name = "lblHeight"; - this.lblHeight.Size = new System.Drawing.Size(104, 18); + this.lblHeight.Size = new System.Drawing.Size(130, 22); this.lblHeight.TabIndex = 34; this.lblHeight.Text = "Height: 2000"; // @@ -194,7 +194,7 @@ this.lblWidth.AutoSize = true; this.lblWidth.Location = new System.Drawing.Point(100, 6); this.lblWidth.Name = "lblWidth"; - this.lblWidth.Size = new System.Drawing.Size(96, 18); + this.lblWidth.Size = new System.Drawing.Size(120, 22); this.lblWidth.TabIndex = 33; this.lblWidth.Text = "width: 2000"; // @@ -204,7 +204,7 @@ this.label11.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label11.Location = new System.Drawing.Point(6, 0); this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(64, 18); + this.label11.Size = new System.Drawing.Size(80, 22); this.label11.TabIndex = 29; this.label11.Text = "Drawing"; // @@ -237,7 +237,7 @@ this.label14.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label14.Location = new System.Drawing.Point(6, 0); this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(120, 18); + this.label14.Size = new System.Drawing.Size(150, 22); this.label14.TabIndex = 29; this.label14.Text = "Selected color"; // @@ -269,7 +269,7 @@ this.lblHoveringColor.AutoSize = true; this.lblHoveringColor.Location = new System.Drawing.Point(6, 22); this.lblHoveringColor.Name = "lblHoveringColor"; - this.lblHoveringColor.Size = new System.Drawing.Size(232, 18); + this.lblHoveringColor.Size = new System.Drawing.Size(290, 22); this.lblHoveringColor.TabIndex = 1; this.lblHoveringColor.Text = "Hex:FFFFFF R:255 G:255 B:255"; // @@ -279,7 +279,7 @@ this.label15.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label15.Location = new System.Drawing.Point(6, 0); this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(120, 18); + this.label15.Size = new System.Drawing.Size(150, 22); this.label15.TabIndex = 29; this.label15.Text = "Hovering color"; // @@ -301,7 +301,7 @@ 0, 0}); this.nupPencilWidth.Name = "nupPencilWidth"; - this.nupPencilWidth.Size = new System.Drawing.Size(141, 17); + this.nupPencilWidth.Size = new System.Drawing.Size(141, 21); this.nupPencilWidth.TabIndex = 17; this.nupPencilWidth.Value = new decimal(new int[] { 10, @@ -316,7 +316,7 @@ this.label9.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.Location = new System.Drawing.Point(7, 142); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(77, 16); + this.label9.Size = new System.Drawing.Size(99, 20); this.label9.TabIndex = 19; this.label9.Text = "Tool width"; // @@ -326,7 +326,7 @@ this.label5.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.Location = new System.Drawing.Point(10, 73); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(70, 16); + this.label5.Size = new System.Drawing.Size(90, 20); this.label5.TabIndex = 9; this.label5.Text = "Set color"; // @@ -372,7 +372,7 @@ this.label4.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.Location = new System.Drawing.Point(10, 25); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(105, 16); + this.label4.Size = new System.Drawing.Size(135, 20); this.label4.TabIndex = 1; this.label4.Text = "Colors history"; // @@ -409,7 +409,7 @@ this.label13.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label13.Location = new System.Drawing.Point(6, 0); this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(48, 18); + this.label13.Size = new System.Drawing.Size(60, 22); this.label13.TabIndex = 29; this.label13.Text = "Tools"; // @@ -437,6 +437,21 @@ this.panelTools.Size = new System.Drawing.Size(163, 593); this.panelTools.TabIndex = 31; // + // btnColorPicker + // + this.btnColorPicker.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnColorPicker.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(41)))), ((int)(((byte)(41))))); + this.btnColorPicker.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.btnColorPicker.Font = new System.Drawing.Font("Cascadia Code", 10.5F); + this.btnColorPicker.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); + this.btnColorPicker.Location = new System.Drawing.Point(9, 92); + this.btnColorPicker.Name = "btnColorPicker"; + this.btnColorPicker.Size = new System.Drawing.Size(141, 31); + this.btnColorPicker.TabIndex = 33; + this.btnColorPicker.Text = "ColorPicker"; + this.btnColorPicker.UseVisualStyleBackColor = false; + this.btnColorPicker.Click += new System.EventHandler(this.btnColorPicker_Click); + // // btnRedo // this.btnRedo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(41)))), ((int)(((byte)(41))))); @@ -485,7 +500,7 @@ this.label2.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(6, 181); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(42, 16); + this.label2.Size = new System.Drawing.Size(54, 20); this.label2.TabIndex = 33; this.label2.Text = "Tools"; // @@ -495,31 +510,16 @@ this.lsbTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.lsbTools.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); this.lsbTools.FormattingEnabled = true; - this.lsbTools.ItemHeight = 18; + this.lsbTools.ItemHeight = 22; this.lsbTools.Location = new System.Drawing.Point(10, 204); this.lsbTools.Name = "lsbTools"; - this.lsbTools.Size = new System.Drawing.Size(141, 164); + this.lsbTools.Size = new System.Drawing.Size(141, 156); this.lsbTools.TabIndex = 32; this.lsbTools.SelectedIndexChanged += new System.EventHandler(this.lsbTools_SelectedIndexChanged); // - // btnColorPicker - // - this.btnColorPicker.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnColorPicker.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(41)))), ((int)(((byte)(41))))); - this.btnColorPicker.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.btnColorPicker.Font = new System.Drawing.Font("Cascadia Code", 10.5F); - this.btnColorPicker.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); - this.btnColorPicker.Location = new System.Drawing.Point(9, 92); - this.btnColorPicker.Name = "btnColorPicker"; - this.btnColorPicker.Size = new System.Drawing.Size(141, 31); - this.btnColorPicker.TabIndex = 33; - this.btnColorPicker.Text = "ColorPicker"; - this.btnColorPicker.UseVisualStyleBackColor = false; - this.btnColorPicker.Click += new System.EventHandler(this.btnColorPicker_Click); - // // PaintForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); this.ClientSize = new System.Drawing.Size(1111, 702); @@ -537,6 +537,7 @@ this.MinimumSize = new System.Drawing.Size(1111, 702); this.Name = "PaintForm"; this.Text = "Paint 2"; + this.Load += new System.EventHandler(this.PaintForm_Load); this.Resize += new System.EventHandler(this.PaintForm_Resize); ((System.ComponentModel.ISupportInitialize)(this.canvas)).EndInit(); this.panelFile.ResumeLayout(false); diff --git a/Paint_2/Form1.cs b/Paint_2/Form1.cs index 660eb70..d5e36f6 100644 --- a/Paint_2/Form1.cs +++ b/Paint_2/Form1.cs @@ -2,7 +2,8 @@ /// Author: Maxime Rohmer /// Brief: Class that is controlling the view /// Version: 0.1.0 -/// Date: 25/05/2022 +/// Date: 08/06/2022 + using System; using System.Collections.Generic; using System.ComponentModel; @@ -225,5 +226,10 @@ namespace Paint_2 cp.Show(); //cd.ShowDialog(); } + + private void PaintForm_Load(object sender, EventArgs e) + { + + } } } diff --git a/Paint_2/PaintTool.cs b/Paint_2/PaintTool.cs index 517cf56..84b2a0c 100644 --- a/Paint_2/PaintTool.cs +++ b/Paint_2/PaintTool.cs @@ -2,7 +2,8 @@ /// Author: Maxime Rohmer /// Brief: Interface that is here to define what is a paint tool /// Version: 0.1.0 -/// Date: 25/05/2022 +/// Date: 08/06/2022 + using System; using System.Collections.Generic; using System.Linq; diff --git a/Paint_2/PaintToolUtils.cs b/Paint_2/PaintToolUtils.cs index 56c6001..26c1215 100644 --- a/Paint_2/PaintToolUtils.cs +++ b/Paint_2/PaintToolUtils.cs @@ -1,4 +1,10 @@ -using System; +/// file: PaintToolUtils.cs +/// Author: Maxime Rohmer +/// Brief: A class that groups all the frequently used by painttools methods +/// Version: 0.1.0 +/// Date: 08/06/2022 + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -69,7 +75,6 @@ namespace Paint_2 public List SandartGetLastColors(int colorNumber) { List result = new List(); - //We need to fill with black color for (int i = Target.Colors.Count; i > 0; i--) { @@ -79,7 +84,6 @@ namespace Paint_2 result.Add(targetColor); } } - //for (int i = colorNumber - Target.Colors.Count; i > 0; i--) for (int i = colorNumber - result.Count; i > 0; i--) { result.Add(Color.FromArgb(0x00, 0x00, 0x00)); diff --git a/Paint_2/Pencil.cs b/Paint_2/Pencil.cs index 5575239..ef04766 100644 --- a/Paint_2/Pencil.cs +++ b/Paint_2/Pencil.cs @@ -2,7 +2,8 @@ /// Author: Maxime Rohmer /// Brief: Paint tool that is kind of the default tool /// Version: 0.1.0 -/// Date: 25/05/2022 +/// Date: 08/06/2022 + using System; using System.Collections.Generic; using System.Drawing; @@ -46,8 +47,6 @@ namespace Paint_2 Widths = new List(); WidthsRedo = new List(); Name = name; - - Utils = new PaintToolUtils(this); } public void Add(Point point) @@ -69,7 +68,7 @@ namespace Paint_2 gr.FillEllipse(new SolidBrush(Colors[drawingCounter]), new Rectangle(new Point(p.X - pointSize.Width / 2, p.Y - pointSize.Height / 2), pointSize)); if (pointCounter > 0) { - gr.DrawLine(new Pen(Colors[drawingCounter], Widths[drawingCounter]), drawing[pointCounter -1], p); + gr.DrawLine(new Pen(Colors[drawingCounter], Widths[drawingCounter]), drawing[pointCounter - 1], p); } pointCounter += 1; } @@ -78,7 +77,7 @@ namespace Paint_2 } public void Start(Color color, int width) { - Utils.StandartStart(color,width); + Utils.StandartStart(color, width); } public void Clear() { @@ -93,7 +92,7 @@ namespace Paint_2 } return bmp; } - private Bitmap PostProcessing(List Drawing,Bitmap bmp,int width,Color color) + private Bitmap PostProcessing(List Drawing, Bitmap bmp, int width, Color color) { return bmp; } diff --git a/Paint_2/Sketch.cs b/Paint_2/Sketch.cs index 46eace7..1ba9c4a 100644 --- a/Paint_2/Sketch.cs +++ b/Paint_2/Sketch.cs @@ -2,7 +2,7 @@ /// Author: Maxime Rohmer /// Brief: Class that is used to store and controll the tools and the bitmap /// Version: 0.1.0 -/// Date: 25/05/2022 +/// Date: 08/06/2022 using System; using System.Collections.Generic;