Compare commits

...

19 Commits

Author SHA1 Message Date
Maxluli e243b37884 Fixed the SVG generator of the bezier pencil 2022-06-22 09:42:21 +02:00
Maxluli 640796a1b1 Reworked 4 pencils and added the ability to CTRL+Drag to change the shapes while drawing them 2022-06-22 09:29:55 +02:00
Maxluli 44dd8b9f0c improved the bezier generator 2022-06-20 16:24:50 +02:00
Maxluli 95217bb3c5 the Save SVG button now prompts a form to select the folder 2022-06-20 14:23:06 +02:00
Maxluli 9b4cfb33bd Added support for SVG painting for all the current pencils 2022-06-20 14:02:17 +02:00
Maxluli 15a4daf2f7 Added painting in SVG (ONLY FOR THE PENCIL AND DOT PENCIL FOR) 2022-06-20 13:01:22 +02:00
Maxluli dfc8ca24dd Added new tools and their preview 2022-06-17 13:51:51 +02:00
Maxluli 2dc7035f80 Fixed the newly introduced bug where not having any layer focused was crashing the app 2022-06-17 12:55:20 +02:00
Maxluli bbf3b66ed9 Added the rectangle Tool and the ability for each tool to be painted or force painted 2022-06-16 15:01:48 +02:00
Maxluli 2c0ac2979a Updated Bezier pencil and the sample box is now much better because it actually simulate the PaintTool 2022-06-16 14:30:10 +02:00
Maxluli f339c5e411 More UI additions 2022-06-15 16:16:50 +02:00
Maxluli a464514745 Edited the layers auto generated controls 2022-06-15 14:37:56 +02:00
Maxluli 942185c3b4 More Ui tweaks 2022-06-15 14:00:51 +02:00
Maxluli bc674dad86 Did some Ui tweaks and added some space for future expansions 2022-06-15 13:43:55 +02:00
Maxluli 5cac05a9aa Added layer removal 2022-06-15 10:58:51 +02:00
Maxluli 47e57db137 Added multi layer support 2022-06-10 18:19:56 +02:00
Maxluli 97d800af1f The main color picker is also drag and drop now 2022-06-09 13:27:11 +02:00
Maxluli 44956fbc59 Fixed the eyedropping bug 2022-06-08 16:30:04 +02:00
Maxluli f5f6056db1 Added a eyedropper tool but its buggy af and I dont know why 2022-06-08 16:20:55 +02:00
17 changed files with 2237 additions and 368 deletions
+124 -11
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A unique tool that draws Bezier curves /// Brief: A unique tool that draws Bezier curves
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -17,6 +17,9 @@ namespace Paint_2
{ {
private List<List<Point>> _drawings; private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo; private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isCtrlPressed;
private bool _isShiftPressed;
private PaintToolUtils Utils; private PaintToolUtils Utils;
private List<Color> _colors; private List<Color> _colors;
private List<Color> _colorsRedo; private List<Color> _colorsRedo;
@@ -28,16 +31,20 @@ namespace Paint_2
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; } public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; } public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public List<Color> Colors { get => _colors; set => _colors = value; } public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; } public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; } public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; } public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public Color Color { get => _color; set => _color = value; } public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; } public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; } public int Width { get => _width; set => _width = value; }
public BezierPencil(string name) public BezierPencil(string name)
{ {
NeedsFullRefresh = true;
Drawings = new List<List<Point>>(); Drawings = new List<List<Point>>();
DrawingsRedo = new List<List<Point>>(); DrawingsRedo = new List<List<Point>>();
Colors = new List<Color>(); Colors = new List<Color>();
@@ -79,16 +86,53 @@ namespace Paint_2
} }
if (points.Count > 0) if (points.Count > 0)
{ {
for (int i = 0; i < points.Count; i++)
for (int i = 1; i <= points.Count; i++)
{ {
pointSize = new Size(Widths[0], Widths[0]); pointSize = new Size(Widths[0] / 2, Widths[0] / 2);
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, Colors[Colors.Count-1], Widths[Widths.Count -1]);
ContinuousBezierGenerator(gr, points, i); AdjustedBezierGenerator(gr, points, Colors[Colors.Count - 1], Widths[Widths.Count - 1]);
} }
} }
} }
private void ContinuousBezierGenerator(Graphics gr, List<Point> points, int i) private void AdjustedBezierGenerator(Graphics gr, List<Point> points, Color color, int width)
{
foreach (Point p in points)
{
gr.FillEllipse(new SolidBrush(color), new Rectangle(new Point(p.X - width / 2, p.Y - width / 2), new Size(width,width)));
}
if (points.Count >= 3)
{
float precision = 0.01f;
for (float t = 0; t <= 1; t += precision)
{
List<Point> DumpList = new List<Point>();
List<Point> WorkingList = new List<Point>();
foreach (Point p in points)
{
WorkingList.Add(new Point(p.X, p.Y));
}
while (WorkingList.Count > 1)
{
for (int i = 0; i < WorkingList.Count - 1; i++)
{
Point p1 = WorkingList[i];
Point p2 = WorkingList[i + 1];
Point tmp = Utils.Lerp(p1, p2, t);
DumpList.Add(tmp);
}
WorkingList.Clear();
foreach (Point p in DumpList)
{
WorkingList.Add(new Point(p.X, p.Y));
}
DumpList.Clear();
}
gr.FillEllipse(new SolidBrush(color), new Rectangle(WorkingList[0].X - Widths[0] / 2, WorkingList[0].Y - Widths[0] / 2, width, width));
}
}
}
private void ContinuousBezierGenerator(Graphics gr, List<Point> points, Color color, int width)
{ {
if (points.Count >= 4 && points.Count % 2 == 0) if (points.Count >= 4 && points.Count % 2 == 0)
{ {
@@ -100,7 +144,7 @@ namespace Paint_2
while (WorkingList.Count != 1) while (WorkingList.Count != 1)
{ {
if (WorkingList.Count > 2) if (WorkingList.Count > 1)
{ {
for (int pos = 0; pos < WorkingList.Count - 1; pos++) for (int pos = 0; pos < WorkingList.Count - 1; pos++)
{ {
@@ -114,10 +158,76 @@ namespace Paint_2
WorkingList = new List<Point>(DumpList); WorkingList = new List<Point>(DumpList);
DumpList = new List<Point>(); DumpList = new List<Point>();
} }
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));
} }
} }
} }
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
Size pointSize;
List<Point> points = new List<Point>();
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count > 0)
{
points.Add(drawing[0]);
}
}
if (points.Count > 0)
{
for (int i = 0; i < points.Count; i++)
{
pointSize = new Size(Widths[0] / 2, Widths[0] / 2);
//Not really usefull in the SVG world because only the last layer will be displayed
//result += "<ellipse cx=\"" + points[i].X + "\" cy=\"" + points[i].Y + "\" rx=\"" + pointSize.Width / 2 + "\" ry=\"" + pointSize.Height / 2 + "\" style=\"fill:rgb(" + Colors[i].R + ", " + Colors[i].G + ", " + Colors[i].B + ");\"/>";
//result += newLine;
result += ContinuousBezierGeneratorSVG(points, Colors[Colors.Count - 1], Widths[Widths.Count - 1]);
}
}
return result;
}
private string ContinuousBezierGeneratorSVG(List<Point> points, Color color, int width)
{
string result = "";
string newLine = Environment.NewLine;
if (points.Count >= 3)
{
float precision = 0.01f;
for (float t = 0; t <= 1; t += precision)
{
List<Point> DumpList = new List<Point>();
List<Point> WorkingList = new List<Point>();
foreach (Point p in points)
{
WorkingList.Add(new Point(p.X, p.Y));
}
while (WorkingList.Count > 1)
{
for (int i = 0; i < WorkingList.Count - 1; i++)
{
Point p1 = WorkingList[i];
Point p2 = WorkingList[i + 1];
Point tmp = Utils.Lerp(p1, p2, t);
DumpList.Add(tmp);
}
WorkingList.Clear();
foreach (Point p in DumpList)
{
WorkingList.Add(new Point(p.X, p.Y));
}
DumpList.Clear();
}
result += "<ellipse cx=\"" + WorkingList[0].X + "\" cy=\"" + WorkingList[0].Y + "\" rx=\"" + width / 2 + "\" ry=\"" + width / 2 + "\" style=\"fill:rgb(" + color.R + ", " + color.G + ", " + color.B + ");\"/>";
result += newLine;
}
}
return result;
}
private void BezierGenerator(Graphics gr, Point p1, Point p2, Point p3, Point p4, int i) private void BezierGenerator(Graphics gr, Point p1, Point p2, Point p3, Point p4, int i)
{ {
gr.DrawLine(new Pen(Colors[i - 4], Widths[i - 4]), p1, p2); gr.DrawLine(new Pen(Colors[i - 4], Widths[i - 4]), p1, p2);
@@ -173,9 +283,12 @@ namespace Paint_2
Utils.StandartRedo(); Utils.StandartRedo();
} }
public Bitmap Stop(Bitmap bmp) public object Clone()
{ {
return bmp; BezierPencil result = new BezierPencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
} }
} }
} }
+49 -35
View File
@@ -42,7 +42,8 @@
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.tmrRefresh = new System.Windows.Forms.Timer(this.components); this.tmrRefreshBars = new System.Windows.Forms.Timer(this.components);
this.tmrRefreshMain = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pbxColor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxColor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbxSelectedColor)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxSelectedColor)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nupRed)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nupRed)).BeginInit();
@@ -57,20 +58,21 @@
// //
this.pbxColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxColor.Location = new System.Drawing.Point(13, 13); this.pbxColor.Location = new System.Drawing.Point(13, 13);
this.pbxColor.Margin = new System.Windows.Forms.Padding(4); this.pbxColor.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.pbxColor.Name = "pbxColor"; this.pbxColor.Name = "pbxColor";
this.pbxColor.Size = new System.Drawing.Size(255, 255); this.pbxColor.Size = new System.Drawing.Size(255, 255);
this.pbxColor.TabIndex = 0; this.pbxColor.TabIndex = 0;
this.pbxColor.TabStop = false; this.pbxColor.TabStop = false;
this.pbxColor.Click += new System.EventHandler(this.pbxColor_Click); this.pbxColor.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbxColor_MouseDown);
this.pbxColor.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pbxColor_MouseUp);
// //
// pbxSelectedColor // pbxSelectedColor
// //
this.pbxSelectedColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxSelectedColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pbxSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbxSelectedColor.Location = new System.Drawing.Point(326, 205); this.pbxSelectedColor.Location = new System.Drawing.Point(311, 189);
this.pbxSelectedColor.Name = "pbxSelectedColor"; this.pbxSelectedColor.Name = "pbxSelectedColor";
this.pbxSelectedColor.Size = new System.Drawing.Size(100, 100); this.pbxSelectedColor.Size = new System.Drawing.Size(116, 116);
this.pbxSelectedColor.TabIndex = 4; this.pbxSelectedColor.TabIndex = 4;
this.pbxSelectedColor.TabStop = false; this.pbxSelectedColor.TabStop = false;
this.pbxSelectedColor.Click += new System.EventHandler(this.pbxSelectedColor_Click); this.pbxSelectedColor.Click += new System.EventHandler(this.pbxSelectedColor_Click);
@@ -79,16 +81,16 @@
// //
this.nupRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupRed.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupRed.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupRed.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupRed.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupRed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupRed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupRed.Location = new System.Drawing.Point(348, 12); this.nupRed.Location = new System.Drawing.Point(336, 58);
this.nupRed.Maximum = new decimal(new int[] { this.nupRed.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupRed.Name = "nupRed"; this.nupRed.Name = "nupRed";
this.nupRed.Size = new System.Drawing.Size(78, 27); this.nupRed.Size = new System.Drawing.Size(91, 25);
this.nupRed.TabIndex = 11; this.nupRed.TabIndex = 11;
this.nupRed.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupRed.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -96,16 +98,16 @@
// //
this.nupGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupGreen.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupGreen.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupGreen.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupGreen.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupGreen.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupGreen.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupGreen.Location = new System.Drawing.Point(348, 46); this.nupGreen.Location = new System.Drawing.Point(336, 89);
this.nupGreen.Maximum = new decimal(new int[] { this.nupGreen.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupGreen.Name = "nupGreen"; this.nupGreen.Name = "nupGreen";
this.nupGreen.Size = new System.Drawing.Size(78, 27); this.nupGreen.Size = new System.Drawing.Size(91, 25);
this.nupGreen.TabIndex = 16; this.nupGreen.TabIndex = 16;
this.nupGreen.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupGreen.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -113,16 +115,16 @@
// //
this.nupBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupBlue.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupBlue.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupBlue.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupBlue.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupBlue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupBlue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupBlue.Location = new System.Drawing.Point(348, 79); this.nupBlue.Location = new System.Drawing.Point(336, 120);
this.nupBlue.Maximum = new decimal(new int[] { this.nupBlue.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupBlue.Name = "nupBlue"; this.nupBlue.Name = "nupBlue";
this.nupBlue.Size = new System.Drawing.Size(78, 27); this.nupBlue.Size = new System.Drawing.Size(91, 25);
this.nupBlue.TabIndex = 17; this.nupBlue.TabIndex = 17;
this.nupBlue.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupBlue.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -130,16 +132,16 @@
// //
this.nupGamma.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupGamma.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupGamma.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupGamma.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupGamma.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupGamma.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupGamma.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupGamma.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupGamma.Location = new System.Drawing.Point(348, 112); this.nupGamma.Location = new System.Drawing.Point(336, 151);
this.nupGamma.Maximum = new decimal(new int[] { this.nupGamma.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupGamma.Name = "nupGamma"; this.nupGamma.Name = "nupGamma";
this.nupGamma.Size = new System.Drawing.Size(78, 27); this.nupGamma.Size = new System.Drawing.Size(91, 25);
this.nupGamma.TabIndex = 18; this.nupGamma.TabIndex = 18;
this.nupGamma.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupGamma.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -147,18 +149,20 @@
// //
this.tbxColorHex.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.tbxColorHex.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.tbxColorHex.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxColorHex.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxColorHex.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxColorHex.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.tbxColorHex.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.tbxColorHex.Location = new System.Drawing.Point(326, 155); this.tbxColorHex.Location = new System.Drawing.Point(311, 14);
this.tbxColorHex.Name = "tbxColorHex"; this.tbxColorHex.Name = "tbxColorHex";
this.tbxColorHex.Size = new System.Drawing.Size(100, 27); this.tbxColorHex.Size = new System.Drawing.Size(116, 29);
this.tbxColorHex.TabIndex = 20; this.tbxColorHex.TabIndex = 20;
this.tbxColorHex.Text = "#FFFFFF";
this.tbxColorHex.TextChanged += new System.EventHandler(this.tbxColorHex_TextChanged); this.tbxColorHex.TextChanged += new System.EventHandler(this.tbxColorHex_TextChanged);
this.tbxColorHex.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxColorHex_KeyDown); this.tbxColorHex.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxColorHex_KeyDown);
// //
// pbxSliderRed // pbxSliderRed
// //
this.pbxSliderRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxSliderRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxSliderRed.Location = new System.Drawing.Point(12, 275); this.pbxSliderRed.Location = new System.Drawing.Point(11, 275);
this.pbxSliderRed.Name = "pbxSliderRed"; this.pbxSliderRed.Name = "pbxSliderRed";
this.pbxSliderRed.Size = new System.Drawing.Size(255, 30); this.pbxSliderRed.Size = new System.Drawing.Size(255, 30);
this.pbxSliderRed.TabIndex = 21; this.pbxSliderRed.TabIndex = 21;
@@ -180,54 +184,63 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label1.Location = new System.Drawing.Point(322, 15); this.label1.Location = new System.Drawing.Point(308, 57);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(20, 22); this.label1.Size = new System.Drawing.Size(24, 22);
this.label1.TabIndex = 23; this.label1.TabIndex = 23;
this.label1.Text = "R"; this.label1.Text = "R";
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label2.Location = new System.Drawing.Point(322, 49); this.label2.Location = new System.Drawing.Point(307, 88);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(20, 22); this.label2.Size = new System.Drawing.Size(25, 22);
this.label2.TabIndex = 24; this.label2.TabIndex = 24;
this.label2.Text = "G"; this.label2.Text = "G";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label3.Location = new System.Drawing.Point(322, 82); this.label3.Location = new System.Drawing.Point(307, 119);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 22); this.label3.Size = new System.Drawing.Size(23, 22);
this.label3.TabIndex = 25; this.label3.TabIndex = 25;
this.label3.Text = "B"; this.label3.Text = "B";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label4.Location = new System.Drawing.Point(322, 115); this.label4.Location = new System.Drawing.Point(308, 150);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(20, 22); this.label4.Size = new System.Drawing.Size(23, 22);
this.label4.TabIndex = 26; this.label4.TabIndex = 26;
this.label4.Text = "A"; this.label4.Text = "A";
// //
// tmrRefresh // tmrRefreshBars
// //
this.tmrRefresh.Interval = 1; this.tmrRefreshBars.Interval = 1;
this.tmrRefresh.Tick += new System.EventHandler(this.tmrRefresh_Tick); this.tmrRefreshBars.Tick += new System.EventHandler(this.tmrRefresh_Tick);
//
// tmrRefreshMain
//
this.tmrRefreshMain.Interval = 1;
this.tmrRefreshMain.Tick += new System.EventHandler(this.tmrRefreshMain_Tick);
// //
// ColorPicker // ColorPicker
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34)))));
this.ClientSize = new System.Drawing.Size(440, 316); this.ClientSize = new System.Drawing.Size(433, 314);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@@ -245,7 +258,7 @@
this.Font = new System.Drawing.Font("Cascadia Code", 10.2F); 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214)))));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "ColorPicker"; this.Name = "ColorPicker";
this.Text = "ColorPicker"; this.Text = "ColorPicker";
@@ -280,6 +293,7 @@
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.Timer tmrRefresh; private System.Windows.Forms.Timer tmrRefreshBars;
private System.Windows.Forms.Timer tmrRefreshMain;
} }
} }
+30 -8
View File
@@ -29,7 +29,7 @@ namespace Paint_2
private void ColorPicker_Load(object sender, EventArgs e) private void ColorPicker_Load(object sender, EventArgs e)
{ {
SelectedColor = main.sketch.CurrentTool.Color; SelectedColor = main.Project.GetCurrentToolColor(main.SelectedLayers);
RefreshUi(); RefreshUi();
} }
private Bitmap RefreshMap(Size size) private Bitmap RefreshMap(Size size)
@@ -142,13 +142,20 @@ namespace Paint_2
private void pbxColor_Click(object sender, EventArgs e) private void pbxColor_Click(object sender, EventArgs e)
{ {
cursorLocation = pbxColor.PointToClient(MousePosition); cursorLocation = pbxColor.PointToClient(MousePosition);
SelectedColor = (pbxColor.Image as Bitmap).GetPixel(cursorLocation.X, cursorLocation.Y); if (cursorLocation.X >= 0 && cursorLocation.X < 255 && cursorLocation.Y >= 0 && cursorLocation.Y < 255)
{
Color newColor = (pbxColor.Image as Bitmap).GetPixel(cursorLocation.X, cursorLocation.Y);
if (newColor.R > 0 || newColor.R == 0 && SelectedColor.R < 5) //This is a bad way of fixing a bug where sometimes the mouse inputs are 0,0,0
{
SelectedColor = newColor;
}
RefreshUi(); RefreshUi();
} }
}
private void pbxSliderRed_Click(object sender, EventArgs e) private void pbxSliderRed_Click(object sender, EventArgs e)
{ {
int mouseX = pbxSliderRed.PointToClient(MousePosition).X; int mouseX = pbxSliderRed.PointToClient(MousePosition).X;
if (mouseX >= 0 && mouseX <= 255) if (mouseX >= 0 && mouseX < 255)
{ {
SelectedColor = Color.FromArgb(SelectedColor.A, mouseX, SelectedColor.G, SelectedColor.B); SelectedColor = Color.FromArgb(SelectedColor.A, mouseX, SelectedColor.G, SelectedColor.B);
} }
@@ -157,7 +164,8 @@ namespace Paint_2
private void pbxSliderSaturation_Click(object sender, EventArgs e) private void pbxSliderSaturation_Click(object sender, EventArgs e)
{ {
int mouseY = pbxSliderSaturation.PointToClient(MousePosition).Y; int mouseY = pbxSliderSaturation.PointToClient(MousePosition).Y;
if (mouseY >= 0 && mouseY <= 255) { if (mouseY >= 0 && mouseY <= 255)
{
SelectedColor = Color.FromArgb(mouseY, SelectedColor.R, SelectedColor.G, SelectedColor.B); SelectedColor = Color.FromArgb(mouseY, SelectedColor.R, SelectedColor.G, SelectedColor.B);
} }
RefreshUi(); RefreshUi();
@@ -245,7 +253,7 @@ namespace Paint_2
private void ColorPicker_FormClosing(object sender, FormClosingEventArgs e) private void ColorPicker_FormClosing(object sender, FormClosingEventArgs e)
{ {
main.sketch.ChangePaintToolColor(SelectedColor); main.Project.ChangeColor(main.SelectedLayers, SelectedColor);
} }
private void tbxColorHex_KeyDown(object sender, KeyEventArgs e) private void tbxColorHex_KeyDown(object sender, KeyEventArgs e)
@@ -263,7 +271,7 @@ namespace Paint_2
private void pbxSelectedColor_Click(object sender, EventArgs e) private void pbxSelectedColor_Click(object sender, EventArgs e)
{ {
main.sketch.ChangePaintToolColor(SelectedColor); main.Project.ChangeColor(main.SelectedLayers, SelectedColor);
} }
private void tmrRefresh_Tick(object sender, EventArgs e) private void tmrRefresh_Tick(object sender, EventArgs e)
@@ -271,15 +279,29 @@ namespace Paint_2
pbxSliderSaturation_Click(sender, e); pbxSliderSaturation_Click(sender, e);
pbxSliderRed_Click(sender, e); pbxSliderRed_Click(sender, e);
} }
private void tmrRefreshMain_Tick(object sender, EventArgs e)
{
pbxColor_Click(sender, e);
}
private void SliderMouseDown(object sender, MouseEventArgs e) private void SliderMouseDown(object sender, MouseEventArgs e)
{ {
tmrRefresh.Enabled = true; tmrRefreshBars.Enabled = true;
} }
private void SliderMouseUp(object sender, MouseEventArgs e) private void SliderMouseUp(object sender, MouseEventArgs e)
{ {
tmrRefresh.Enabled = false; tmrRefreshBars.Enabled = false;
}
private void pbxColor_MouseDown(object sender, MouseEventArgs e)
{
tmrRefreshMain.Enabled = true;
}
private void pbxColor_MouseUp(object sender, MouseEventArgs e)
{
tmrRefreshMain.Enabled = false;
} }
} }
} }
+4 -1
View File
@@ -117,7 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="tmrRefresh.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="tmrRefreshBars.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="tmrRefreshMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>177, 17</value>
</metadata>
</root> </root>
+43 -4
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A variant of the default tool /// Brief: A variant of the default tool
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -15,10 +15,13 @@ namespace Paint_2
{ {
public class DotPencil : PaintTool public class DotPencil : PaintTool
{ {
const int POST_PROCESSING_PRECISION = 3; const int POST_PROCESSING_PRECISION = 1;
private List<List<Point>> _drawings; private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo; private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private PaintToolUtils Utils; private PaintToolUtils Utils;
private List<Color> _colors; private List<Color> _colors;
private List<Color> _colorsRedo; private List<Color> _colorsRedo;
@@ -30,6 +33,9 @@ namespace Paint_2
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; } public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; } public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public List<Color> Colors { get => _colors; set => _colors = value; } public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; } public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; } public List<int> Widths { get => _widths; set => _widths = value; }
@@ -47,6 +53,7 @@ namespace Paint_2
Widths = new List<int>(); Widths = new List<int>();
WidthsRedo = new List<int>(); WidthsRedo = new List<int>();
Name = name; Name = name;
NeedsFullRefresh = false;
Utils = new PaintToolUtils(this); Utils = new PaintToolUtils(this);
} }
@@ -128,9 +135,41 @@ namespace Paint_2
Utils.StandartRedo(); Utils.StandartRedo();
} }
public Bitmap Stop(Bitmap bmp) public object Clone()
{ {
return bmp; DotPencil result = new DotPencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
for (int drawCount = 0; drawCount < Drawings.Count; drawCount++)
{
Point p1;
Point p2;
List<Point> drawing = Drawings[drawCount];
Color color = Colors[drawCount];
int width = Widths[drawCount];
for (int pointIndex = 0; pointIndex < drawing.Count; pointIndex++)
{
if (pointIndex >= 1)
{
p1 = drawing[pointIndex - 1];
p2 = drawing[pointIndex];
result += "<ellipse cx=\"" + p2.X + "\" cy=\"" + p2.Y + "\" rx=\"" + width / 2 + "\" ry=\"" + width / 2 + "\" style=\"fill:rgb(" + color.R + ", " + color.G + ", " + color.B + ");\"/>";
result += newLine;
}
}
}
return result;
} }
} }
} }
+179
View File
@@ -0,0 +1,179 @@
/// file: EllipseBorderPencil.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A tool that paints the outline of an ellipse
/// Version: 0.1.0
/// Date: 17/06/2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Paint_2
{
internal class EllipseBorderPencil : PaintTool
{
private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private PaintToolUtils Utils;
private List<Color> _colors;
private List<Color> _colorsRedo;
private List<int> _widths;
private List<int> _widthsRedo;
private Color _color;
private string _name;
private int _width;
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; }
public EllipseBorderPencil(string name)
{
NeedsFullRefresh = true;
Drawings = new List<List<Point>>();
DrawingsRedo = new List<List<Point>>();
Colors = new List<Color>();
ColorsRedo = new List<Color>();
Widths = new List<int>();
WidthsRedo = new List<int>();
Name = name;
Utils = new PaintToolUtils(this);
}
public void Add(Point point)
{
List<Point> myDrawing = Drawings[Drawings.Count - 1];
if (myDrawing.Count == 0 || myDrawing.Count == 1)
{
myDrawing.Add(point);
}
else
{
myDrawing[1] = point;
}
Drawings[Drawings.Count - 1] = myDrawing;
}
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
int drawingCounter = 0;
Size pointSize;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
start = points[0];
end = points[1];
Size size = new Size((end.X - start.X) / 2, (end.Y - start.Y) / 2);
result += "<ellipse cx=\"" + (start.X + size.Width) + "\" cy=\"" + (start.Y + size.Height) + "\" rx=\"" + size.Width + "\" ry=\"" + size.Height + "\" style=\"stroke:rgb(" + Colors[drawingCounter].R + ", " + Colors[drawingCounter].G + ", " + Colors[drawingCounter].B + ");\" stroke-width=\"" + Widths[drawingCounter] + "\" fill=\"none\"/>";
result += newLine;
}
drawingCounter++;
}
return result;
}
public void Paint(Bitmap canvas)
{
Graphics gr = Graphics.FromImage(canvas);
int drawingCounter = 0;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
start = points[0];
end = points[1];
gr.DrawEllipse(new Pen(Colors[drawingCounter], Widths[drawingCounter]), new Rectangle(start, new Size(end.X - start.X, end.Y - start.Y)));
}
drawingCounter++;
}
}
public void Start(Color color, int width)
{
Utils.StandartStart(color, width);
}
public void Clear()
{
Utils.StandartClear();
}
public void Stop()
{
List<Point> myDrawing = Drawings.Last();
Drawings[Drawings.Count - 1] = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, myDrawing[0], myDrawing[1]);
}
private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color)
{
return bmp;
}
public List<Color> GetLastColors(int colorNumber)
{
return Utils.SandartGetLastColors(colorNumber);
}
public override string ToString()
{
return Name;
}
public void Undo()
{
Utils.StandartUndo();
}
public void Redo()
{
Utils.StandartRedo();
}
public object Clone()
{
EllipseBorderPencil result = new EllipseBorderPencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
}
}
+180
View File
@@ -0,0 +1,180 @@
/// file: EllipsePencil.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A tool that paints an ellipse
/// Version: 0.1.0
/// Date: 17/06/2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Paint_2
{
internal class EllipsePencil : PaintTool
{
private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private PaintToolUtils Utils;
private List<Color> _colors;
private List<Color> _colorsRedo;
private List<int> _widths;
private List<int> _widthsRedo;
private Color _color;
private string _name;
private int _width;
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; }
public EllipsePencil(string name)
{
NeedsFullRefresh = true;
Drawings = new List<List<Point>>();
DrawingsRedo = new List<List<Point>>();
Colors = new List<Color>();
ColorsRedo = new List<Color>();
Widths = new List<int>();
WidthsRedo = new List<int>();
Name = name;
Utils = new PaintToolUtils(this);
}
public void Add(Point point)
{
List<Point> myDrawing = Drawings[Drawings.Count - 1];
if (myDrawing.Count == 0 || myDrawing.Count == 1)
{
myDrawing.Add(point);
}
else
{
myDrawing[1] = point;
}
Drawings[Drawings.Count - 1] = myDrawing;
}
public void Paint(Bitmap canvas)
{
Graphics gr = Graphics.FromImage(canvas);
int drawingCounter = 0;
Size pointSize;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
start = points[0];
end = points[1];
gr.FillEllipse(new SolidBrush(Colors[drawingCounter]), new Rectangle(start, new Size(end.X - start.X, end.Y - start.Y)));
}
drawingCounter++;
}
}
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
int drawingCounter = 0;
Size pointSize;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
start = points[0];
end = points[1];
Size size = new Size((end.X - start.X) / 2, (end.Y - start.Y) / 2);
result += "<ellipse cx=\"" + (start.X + size.Width) + "\" cy=\"" + (start.Y + size.Height) + "\" rx=\"" + size.Width + "\" ry=\"" + size.Height + "\" style=\"fill:rgb(" + Colors[drawingCounter].R + ", " + Colors[drawingCounter].G + ", " + Colors[drawingCounter].B + ");\"/>";
result += newLine;
}
drawingCounter++;
}
return result;
}
public void Start(Color color, int width)
{
Utils.StandartStart(color, width);
}
public void Clear()
{
Utils.StandartClear();
}
public void Stop()
{
List<Point> myDrawing = Drawings.Last();
Drawings[Drawings.Count - 1] = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, myDrawing[0], myDrawing[1]);
}
private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color)
{
return bmp;
}
public List<Color> GetLastColors(int colorNumber)
{
return Utils.SandartGetLastColors(colorNumber);
}
public override string ToString()
{
return Name;
}
public void Undo()
{
Utils.StandartUndo();
}
public void Redo()
{
Utils.StandartRedo();
}
public object Clone()
{
EllipsePencil result = new EllipsePencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
}
}
+260 -198
View File
@@ -51,25 +51,28 @@
this.btnColorHistory4 = new System.Windows.Forms.Button(); this.btnColorHistory4 = new System.Windows.Forms.Button();
this.btnColorHistory3 = new System.Windows.Forms.Button(); this.btnColorHistory3 = new System.Windows.Forms.Button();
this.btnColorHistory2 = new System.Windows.Forms.Button(); this.btnColorHistory2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.btnColorHistory1 = new System.Windows.Forms.Button(); this.btnColorHistory1 = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button();
this.panelTools = new System.Windows.Forms.Panel(); this.panelTools = new System.Windows.Forms.Panel();
this.lsbTools = new System.Windows.Forms.ListBox();
this.pbxSample = new System.Windows.Forms.PictureBox(); this.pbxSample = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.btnEyeDrop = new System.Windows.Forms.Button();
this.btnRandomColor = new System.Windows.Forms.Button(); this.btnRandomColor = new System.Windows.Forms.Button();
this.btnColorPicker = new System.Windows.Forms.Button(); this.btnColorPicker = new System.Windows.Forms.Button();
this.btnRedo = new System.Windows.Forms.Button(); this.btnRedo = new System.Windows.Forms.Button();
this.btnUndo = new System.Windows.Forms.Button(); this.btnUndo = new System.Windows.Forms.Button();
this.lsbTools = new System.Windows.Forms.ListBox();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.pnlLayers = new System.Windows.Forms.Panel();
this.btnLayerRemove = new System.Windows.Forms.Button();
this.BtnAddLayer = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button(); this.DebugLabel1 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox(); this.panel4 = new System.Windows.Forms.Panel();
this.btnSvgExport = new System.Windows.Forms.Button();
this.DebugLabel2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.canvas)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.canvas)).BeginInit();
this.panelFile.SuspendLayout(); this.panelFile.SuspendLayout();
this.panelDrawing.SuspendLayout(); this.panelDrawing.SuspendLayout();
@@ -79,8 +82,8 @@
this.panelTools.SuspendLayout(); this.panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxSample)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxSample)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// tbxProjectName // tbxProjectName
@@ -89,10 +92,10 @@
this.tbxProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxProjectName.Font = new System.Drawing.Font("Verdana", 15F); 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.tbxProjectName.Location = new System.Drawing.Point(11, 3); this.tbxProjectName.Location = new System.Drawing.Point(2, 4);
this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2);
this.tbxProjectName.Name = "tbxProjectName"; this.tbxProjectName.Name = "tbxProjectName";
this.tbxProjectName.Size = new System.Drawing.Size(253, 38); this.tbxProjectName.Size = new System.Drawing.Size(225, 32);
this.tbxProjectName.TabIndex = 0; this.tbxProjectName.TabIndex = 0;
this.tbxProjectName.Text = "Untitled Project"; this.tbxProjectName.Text = "Untitled Project";
// //
@@ -101,10 +104,10 @@
this.btnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); 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.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnSave.Location = new System.Drawing.Point(268, 3); this.btnSave.Location = new System.Drawing.Point(231, 3);
this.btnSave.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnSave.Margin = new System.Windows.Forms.Padding(2);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(82, 39); this.btnSave.Size = new System.Drawing.Size(54, 33);
this.btnSave.TabIndex = 1; this.btnSave.TabIndex = 1;
this.btnSave.Text = "Save"; this.btnSave.Text = "Save";
this.btnSave.UseVisualStyleBackColor = false; this.btnSave.UseVisualStyleBackColor = false;
@@ -114,10 +117,10 @@
// //
this.canvas.BackColor = System.Drawing.Color.Transparent; this.canvas.BackColor = System.Drawing.Color.Transparent;
this.canvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.canvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.canvas.Location = new System.Drawing.Point(11, 59); this.canvas.Location = new System.Drawing.Point(10, 49);
this.canvas.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.canvas.Margin = new System.Windows.Forms.Padding(2);
this.canvas.Name = "canvas"; this.canvas.Name = "canvas";
this.canvas.Size = new System.Drawing.Size(900, 500); this.canvas.Size = new System.Drawing.Size(1000, 500);
this.canvas.TabIndex = 2; this.canvas.TabIndex = 2;
this.canvas.TabStop = false; this.canvas.TabStop = false;
this.canvas.MouseDown += new System.Windows.Forms.MouseEventHandler(this.canvas_MouseDown); this.canvas.MouseDown += new System.Windows.Forms.MouseEventHandler(this.canvas_MouseDown);
@@ -128,10 +131,10 @@
this.btnSaveCopy.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); 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.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSaveCopy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnSaveCopy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnSaveCopy.Location = new System.Drawing.Point(354, 3); this.btnSaveCopy.Location = new System.Drawing.Point(289, 3);
this.btnSaveCopy.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnSaveCopy.Margin = new System.Windows.Forms.Padding(2);
this.btnSaveCopy.Name = "btnSaveCopy"; this.btnSaveCopy.Name = "btnSaveCopy";
this.btnSaveCopy.Size = new System.Drawing.Size(135, 39); this.btnSaveCopy.Size = new System.Drawing.Size(92, 33);
this.btnSaveCopy.TabIndex = 2; this.btnSaveCopy.TabIndex = 2;
this.btnSaveCopy.Text = "Save a copy"; this.btnSaveCopy.Text = "Save a copy";
this.btnSaveCopy.UseVisualStyleBackColor = false; this.btnSaveCopy.UseVisualStyleBackColor = false;
@@ -141,23 +144,23 @@
// //
this.lblSelectedColor.AutoSize = true; this.lblSelectedColor.AutoSize = true;
this.lblSelectedColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.lblSelectedColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lblSelectedColor.Location = new System.Drawing.Point(7, 28); this.lblSelectedColor.Location = new System.Drawing.Point(6, 23);
this.lblSelectedColor.Name = "lblSelectedColor"; this.lblSelectedColor.Name = "lblSelectedColor";
this.lblSelectedColor.Size = new System.Drawing.Size(288, 20); this.lblSelectedColor.Size = new System.Drawing.Size(202, 14);
this.lblSelectedColor.TabIndex = 1; this.lblSelectedColor.TabIndex = 1;
this.lblSelectedColor.Text = "Hex:FFFFFF R:255 G:255 B:255"; this.lblSelectedColor.Text = "Hex:FFFFFF R:255 G:255 B:255";
// //
// panelFile // panelFile
// //
this.panelFile.BackColor = System.Drawing.Color.Transparent; this.panelFile.BackColor = System.Drawing.Color.Transparent;
this.panelFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelFile.Controls.Add(this.btnLoadFile); this.panelFile.Controls.Add(this.btnLoadFile);
this.panelFile.Controls.Add(this.tbxProjectName); this.panelFile.Controls.Add(this.tbxProjectName);
this.panelFile.Controls.Add(this.btnSave); this.panelFile.Controls.Add(this.btnSave);
this.panelFile.Controls.Add(this.btnSaveCopy); this.panelFile.Controls.Add(this.btnSaveCopy);
this.panelFile.Location = new System.Drawing.Point(12, 6); this.panelFile.Location = new System.Drawing.Point(10, 6);
this.panelFile.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelFile.Name = "panelFile"; this.panelFile.Name = "panelFile";
this.panelFile.Size = new System.Drawing.Size(644, 47); this.panelFile.Size = new System.Drawing.Size(487, 39);
this.panelFile.TabIndex = 8; this.panelFile.TabIndex = 8;
// //
// btnLoadFile // btnLoadFile
@@ -165,10 +168,10 @@
this.btnLoadFile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); 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.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnLoadFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnLoadFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnLoadFile.Location = new System.Drawing.Point(493, 3); this.btnLoadFile.Location = new System.Drawing.Point(385, 3);
this.btnLoadFile.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnLoadFile.Margin = new System.Windows.Forms.Padding(2);
this.btnLoadFile.Name = "btnLoadFile"; this.btnLoadFile.Name = "btnLoadFile";
this.btnLoadFile.Size = new System.Drawing.Size(143, 39); this.btnLoadFile.Size = new System.Drawing.Size(96, 33);
this.btnLoadFile.TabIndex = 3; this.btnLoadFile.TabIndex = 3;
this.btnLoadFile.Text = "Load Project"; this.btnLoadFile.Text = "Load Project";
this.btnLoadFile.UseVisualStyleBackColor = false; this.btnLoadFile.UseVisualStyleBackColor = false;
@@ -177,21 +180,21 @@
// //
this.panelDrawing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.panelDrawing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.panelDrawing.BackColor = System.Drawing.Color.Transparent; this.panelDrawing.BackColor = System.Drawing.Color.Transparent;
this.panelDrawing.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelDrawing.Controls.Add(this.lblHeight); this.panelDrawing.Controls.Add(this.lblHeight);
this.panelDrawing.Controls.Add(this.lblWidth); this.panelDrawing.Controls.Add(this.lblWidth);
this.panelDrawing.Location = new System.Drawing.Point(829, 575); this.panelDrawing.Location = new System.Drawing.Point(737, 553);
this.panelDrawing.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelDrawing.Name = "panelDrawing"; this.panelDrawing.Name = "panelDrawing";
this.panelDrawing.Size = new System.Drawing.Size(82, 72); this.panelDrawing.Size = new System.Drawing.Size(89, 60);
this.panelDrawing.TabIndex = 30; this.panelDrawing.TabIndex = 30;
// //
// lblHeight // lblHeight
// //
this.lblHeight.AutoSize = true; this.lblHeight.AutoSize = true;
this.lblHeight.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.lblHeight.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lblHeight.Location = new System.Drawing.Point(3, 40); this.lblHeight.Location = new System.Drawing.Point(3, 38);
this.lblHeight.Name = "lblHeight"; this.lblHeight.Name = "lblHeight";
this.lblHeight.Size = new System.Drawing.Size(74, 20); this.lblHeight.Size = new System.Drawing.Size(53, 14);
this.lblHeight.TabIndex = 34; this.lblHeight.TabIndex = 34;
this.lblHeight.Text = "H:2000"; this.lblHeight.Text = "H:2000";
// //
@@ -199,9 +202,9 @@
// //
this.lblWidth.AutoSize = true; this.lblWidth.AutoSize = true;
this.lblWidth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.lblWidth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lblWidth.Location = new System.Drawing.Point(3, 8); this.lblWidth.Location = new System.Drawing.Point(3, 7);
this.lblWidth.Name = "lblWidth"; this.lblWidth.Name = "lblWidth";
this.lblWidth.Size = new System.Drawing.Size(77, 20); this.lblWidth.Size = new System.Drawing.Size(57, 14);
this.lblWidth.TabIndex = 33; this.lblWidth.TabIndex = 33;
this.lblWidth.Text = "W:2000"; this.lblWidth.Text = "W:2000";
// //
@@ -209,13 +212,13 @@
// //
this.panelSelectedColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.panelSelectedColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.panelSelectedColor.BackColor = System.Drawing.Color.Transparent; this.panelSelectedColor.BackColor = System.Drawing.Color.Transparent;
this.panelSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelSelectedColor.Controls.Add(this.btnSelectedColor); this.panelSelectedColor.Controls.Add(this.btnSelectedColor);
this.panelSelectedColor.Controls.Add(this.lblSelectedColor); this.panelSelectedColor.Controls.Add(this.lblSelectedColor);
this.panelSelectedColor.Controls.Add(this.label14); this.panelSelectedColor.Controls.Add(this.label14);
this.panelSelectedColor.Location = new System.Drawing.Point(424, 575); this.panelSelectedColor.Location = new System.Drawing.Point(377, 553);
this.panelSelectedColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelSelectedColor.Name = "panelSelectedColor"; this.panelSelectedColor.Name = "panelSelectedColor";
this.panelSelectedColor.Size = new System.Drawing.Size(399, 72); this.panelSelectedColor.Size = new System.Drawing.Size(355, 60);
this.panelSelectedColor.TabIndex = 31; this.panelSelectedColor.TabIndex = 31;
// //
// btnSelectedColor // btnSelectedColor
@@ -223,9 +226,10 @@
this.btnSelectedColor.BackColor = System.Drawing.Color.Green; this.btnSelectedColor.BackColor = System.Drawing.Color.Green;
this.btnSelectedColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnSelectedColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSelectedColor.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnSelectedColor.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnSelectedColor.Location = new System.Drawing.Point(327, 6); this.btnSelectedColor.Location = new System.Drawing.Point(291, 5);
this.btnSelectedColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnSelectedColor.Name = "btnSelectedColor"; this.btnSelectedColor.Name = "btnSelectedColor";
this.btnSelectedColor.Size = new System.Drawing.Size(60, 60); this.btnSelectedColor.Size = new System.Drawing.Size(53, 49);
this.btnSelectedColor.TabIndex = 31; this.btnSelectedColor.TabIndex = 31;
this.btnSelectedColor.UseVisualStyleBackColor = false; this.btnSelectedColor.UseVisualStyleBackColor = false;
// //
@@ -234,9 +238,9 @@
this.label14.AutoSize = true; this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label14.Font = new System.Drawing.Font("Cascadia Code", 10F);
this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label14.Location = new System.Drawing.Point(7, 6); this.label14.Location = new System.Drawing.Point(6, 5);
this.label14.Name = "label14"; this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(150, 22); this.label14.Size = new System.Drawing.Size(120, 18);
this.label14.TabIndex = 29; this.label14.TabIndex = 29;
this.label14.Text = "Selected color"; this.label14.Text = "Selected color";
// //
@@ -244,13 +248,13 @@
// //
this.panelHoverColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.panelHoverColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.panelHoverColor.BackColor = System.Drawing.Color.Transparent; this.panelHoverColor.BackColor = System.Drawing.Color.Transparent;
this.panelHoverColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelHoverColor.Controls.Add(this.btnHoveringColor); this.panelHoverColor.Controls.Add(this.btnHoveringColor);
this.panelHoverColor.Controls.Add(this.lblHoveringColor); this.panelHoverColor.Controls.Add(this.lblHoveringColor);
this.panelHoverColor.Controls.Add(this.label15); this.panelHoverColor.Controls.Add(this.label15);
this.panelHoverColor.Location = new System.Drawing.Point(11, 575); this.panelHoverColor.Location = new System.Drawing.Point(10, 553);
this.panelHoverColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelHoverColor.Name = "panelHoverColor"; this.panelHoverColor.Name = "panelHoverColor";
this.panelHoverColor.Size = new System.Drawing.Size(407, 72); this.panelHoverColor.Size = new System.Drawing.Size(362, 60);
this.panelHoverColor.TabIndex = 32; this.panelHoverColor.TabIndex = 32;
// //
// btnHoveringColor // btnHoveringColor
@@ -258,9 +262,10 @@
this.btnHoveringColor.BackColor = System.Drawing.Color.Green; this.btnHoveringColor.BackColor = System.Drawing.Color.Green;
this.btnHoveringColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnHoveringColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnHoveringColor.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnHoveringColor.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnHoveringColor.Location = new System.Drawing.Point(335, 6); this.btnHoveringColor.Location = new System.Drawing.Point(298, 5);
this.btnHoveringColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnHoveringColor.Name = "btnHoveringColor"; this.btnHoveringColor.Name = "btnHoveringColor";
this.btnHoveringColor.Size = new System.Drawing.Size(60, 60); this.btnHoveringColor.Size = new System.Drawing.Size(53, 49);
this.btnHoveringColor.TabIndex = 30; this.btnHoveringColor.TabIndex = 30;
this.btnHoveringColor.UseVisualStyleBackColor = false; this.btnHoveringColor.UseVisualStyleBackColor = false;
// //
@@ -268,9 +273,9 @@
// //
this.lblHoveringColor.AutoSize = true; this.lblHoveringColor.AutoSize = true;
this.lblHoveringColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.lblHoveringColor.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lblHoveringColor.Location = new System.Drawing.Point(8, 28); this.lblHoveringColor.Location = new System.Drawing.Point(7, 23);
this.lblHoveringColor.Name = "lblHoveringColor"; this.lblHoveringColor.Name = "lblHoveringColor";
this.lblHoveringColor.Size = new System.Drawing.Size(288, 20); this.lblHoveringColor.Size = new System.Drawing.Size(202, 14);
this.lblHoveringColor.TabIndex = 1; this.lblHoveringColor.TabIndex = 1;
this.lblHoveringColor.Text = "Hex:FFFFFF R:255 G:255 B:255"; this.lblHoveringColor.Text = "Hex:FFFFFF R:255 G:255 B:255";
// //
@@ -279,9 +284,9 @@
this.label15.AutoSize = true; this.label15.AutoSize = true;
this.label15.Font = new System.Drawing.Font("Cascadia Code", 10F); this.label15.Font = new System.Drawing.Font("Cascadia Code", 10F);
this.label15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label15.Location = new System.Drawing.Point(8, 6); this.label15.Location = new System.Drawing.Point(7, 5);
this.label15.Name = "label15"; this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(150, 22); this.label15.Size = new System.Drawing.Size(120, 18);
this.label15.TabIndex = 29; this.label15.TabIndex = 29;
this.label15.Text = "Hovering color"; this.label15.Text = "Hovering color";
// //
@@ -296,14 +301,15 @@
this.nupPencilWidth.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupPencilWidth.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupPencilWidth.Font = new System.Drawing.Font("Cascadia Code", 15F); 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupPencilWidth.Location = new System.Drawing.Point(118, 152); 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[] { this.nupPencilWidth.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupPencilWidth.Name = "nupPencilWidth"; this.nupPencilWidth.Name = "nupPencilWidth";
this.nupPencilWidth.Size = new System.Drawing.Size(71, 33); this.nupPencilWidth.Size = new System.Drawing.Size(55, 27);
this.nupPencilWidth.TabIndex = 17; this.nupPencilWidth.TabIndex = 17;
this.nupPencilWidth.Value = new decimal(new int[] { this.nupPencilWidth.Value = new decimal(new int[] {
10, 10,
@@ -318,9 +324,10 @@
this.btnColorHistory4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnColorHistory4.Location = new System.Drawing.Point(148, 26); 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.Name = "btnColorHistory4";
this.btnColorHistory4.Size = new System.Drawing.Size(40, 40); this.btnColorHistory4.Size = new System.Drawing.Size(36, 33);
this.btnColorHistory4.TabIndex = 4; this.btnColorHistory4.TabIndex = 4;
this.btnColorHistory4.UseVisualStyleBackColor = false; this.btnColorHistory4.UseVisualStyleBackColor = false;
this.btnColorHistory4.Click += new System.EventHandler(this.BtnColor_Click); this.btnColorHistory4.Click += new System.EventHandler(this.BtnColor_Click);
@@ -331,9 +338,10 @@
this.btnColorHistory3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnColorHistory3.Location = new System.Drawing.Point(102, 26); 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.Name = "btnColorHistory3";
this.btnColorHistory3.Size = new System.Drawing.Size(40, 40); this.btnColorHistory3.Size = new System.Drawing.Size(36, 33);
this.btnColorHistory3.TabIndex = 3; this.btnColorHistory3.TabIndex = 3;
this.btnColorHistory3.UseVisualStyleBackColor = false; this.btnColorHistory3.UseVisualStyleBackColor = false;
this.btnColorHistory3.Click += new System.EventHandler(this.BtnColor_Click); this.btnColorHistory3.Click += new System.EventHandler(this.BtnColor_Click);
@@ -344,33 +352,24 @@
this.btnColorHistory2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnColorHistory2.Location = new System.Drawing.Point(56, 26); 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.Name = "btnColorHistory2";
this.btnColorHistory2.Size = new System.Drawing.Size(40, 40); this.btnColorHistory2.Size = new System.Drawing.Size(36, 33);
this.btnColorHistory2.TabIndex = 2; this.btnColorHistory2.TabIndex = 2;
this.btnColorHistory2.UseVisualStyleBackColor = false; this.btnColorHistory2.UseVisualStyleBackColor = false;
this.btnColorHistory2.Click += new System.EventHandler(this.BtnColor_Click); this.btnColorHistory2.Click += new System.EventHandler(this.BtnColor_Click);
// //
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label4.Location = new System.Drawing.Point(7, 3);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(135, 20);
this.label4.TabIndex = 1;
this.label4.Text = "Colors history";
//
// btnColorHistory1 // btnColorHistory1
// //
this.btnColorHistory1.BackColor = System.Drawing.Color.Green; this.btnColorHistory1.BackColor = System.Drawing.Color.Green;
this.btnColorHistory1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnColorHistory1.Location = new System.Drawing.Point(10, 26); 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.Name = "btnColorHistory1";
this.btnColorHistory1.Size = new System.Drawing.Size(40, 40); this.btnColorHistory1.Size = new System.Drawing.Size(36, 33);
this.btnColorHistory1.TabIndex = 0; this.btnColorHistory1.TabIndex = 0;
this.btnColorHistory1.UseVisualStyleBackColor = false; this.btnColorHistory1.UseVisualStyleBackColor = false;
this.btnColorHistory1.Click += new System.EventHandler(this.BtnColor_Click); this.btnColorHistory1.Click += new System.EventHandler(this.BtnColor_Click);
@@ -380,11 +379,12 @@
this.btnClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Popup; 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnClear.Location = new System.Drawing.Point(4, 38); 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.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(190, 29); this.btnClear.Size = new System.Drawing.Size(169, 24);
this.btnClear.TabIndex = 27; this.btnClear.TabIndex = 27;
this.btnClear.Text = "Clear"; this.btnClear.Text = "Clear";
this.btnClear.UseVisualStyleBackColor = false; this.btnClear.UseVisualStyleBackColor = false;
@@ -394,38 +394,75 @@
// //
this.panelTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panelTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panelTools.BackColor = System.Drawing.Color.Transparent; this.panelTools.BackColor = System.Drawing.Color.Transparent;
this.panelTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTools.Controls.Add(this.pbxSample);
this.panelTools.Controls.Add(this.btnRandomColor);
this.panelTools.Controls.Add(this.btnColorPicker);
this.panelTools.Controls.Add(this.btnColorHistory1);
this.panelTools.Controls.Add(this.label4);
this.panelTools.Controls.Add(this.btnColorHistory2);
this.panelTools.Controls.Add(this.btnColorHistory3);
this.panelTools.Controls.Add(this.btnColorHistory4);
this.panelTools.Controls.Add(this.nupPencilWidth); this.panelTools.Controls.Add(this.nupPencilWidth);
this.panelTools.Location = new System.Drawing.Point(920, 6); this.panelTools.Controls.Add(this.lsbTools);
this.panelTools.Controls.Add(this.pbxSample);
this.panelTools.Controls.Add(this.label1);
this.panelTools.Location = new System.Drawing.Point(1014, 6);
this.panelTools.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelTools.Name = "panelTools"; this.panelTools.Name = "panelTools";
this.panelTools.Size = new System.Drawing.Size(200, 193); this.panelTools.Size = new System.Drawing.Size(196, 232);
this.panelTools.TabIndex = 31; this.panelTools.TabIndex = 31;
// //
// lsbTools
//
this.lsbTools.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.lsbTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lsbTools.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lsbTools.FormattingEnabled = true;
this.lsbTools.ItemHeight = 14;
this.lsbTools.Location = new System.Drawing.Point(6, 20);
this.lsbTools.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lsbTools.Name = "lsbTools";
this.lsbTools.Size = new System.Drawing.Size(183, 128);
this.lsbTools.TabIndex = 32;
this.lsbTools.SelectedIndexChanged += new System.EventHandler(this.lsbTools_SelectedIndexChanged);
//
// pbxSample // pbxSample
// //
this.pbxSample.Location = new System.Drawing.Point(10, 152); 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.Name = "pbxSample";
this.pbxSample.Size = new System.Drawing.Size(101, 33); this.pbxSample.Size = new System.Drawing.Size(122, 64);
this.pbxSample.TabIndex = 35; this.pbxSample.TabIndex = 35;
this.pbxSample.TabStop = false; this.pbxSample.TabStop = false;
// //
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label1.Location = new System.Drawing.Point(3, 2);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 16);
this.label1.TabIndex = 36;
this.label1.Text = "Paint tools";
//
// btnEyeDrop
//
this.btnEyeDrop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
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, 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);
this.btnEyeDrop.TabIndex = 36;
this.btnEyeDrop.Text = "EyeDropper";
this.btnEyeDrop.UseVisualStyleBackColor = false;
this.btnEyeDrop.Click += new System.EventHandler(this.btnEyeDrop_Click);
//
// btnRandomColor // btnRandomColor
// //
this.btnRandomColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnRandomColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnRandomColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnRandomColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnRandomColor.Font = new System.Drawing.Font("Cascadia Code", 10.2F); 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnRandomColor.Location = new System.Drawing.Point(11, 113); 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.Name = "btnRandomColor";
this.btnRandomColor.Size = new System.Drawing.Size(178, 33); this.btnRandomColor.Size = new System.Drawing.Size(108, 33);
this.btnRandomColor.TabIndex = 34; this.btnRandomColor.TabIndex = 34;
this.btnRandomColor.Text = "Random "; this.btnRandomColor.Text = "Random ";
this.btnRandomColor.UseVisualStyleBackColor = false; this.btnRandomColor.UseVisualStyleBackColor = false;
@@ -437,9 +474,10 @@
this.btnColorPicker.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnColorPicker.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnColorPicker.Font = new System.Drawing.Font("Cascadia Code", 10.2F); 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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnColorPicker.Location = new System.Drawing.Point(10, 72); 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.Name = "btnColorPicker";
this.btnColorPicker.Size = new System.Drawing.Size(177, 35); this.btnColorPicker.Size = new System.Drawing.Size(106, 33);
this.btnColorPicker.TabIndex = 33; this.btnColorPicker.TabIndex = 33;
this.btnColorPicker.Text = "ColorPicker"; this.btnColorPicker.Text = "ColorPicker";
this.btnColorPicker.UseVisualStyleBackColor = false; this.btnColorPicker.UseVisualStyleBackColor = false;
@@ -449,11 +487,12 @@
// //
this.btnRedo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnRedo.Location = new System.Drawing.Point(3, 6); 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.Name = "btnRedo";
this.btnRedo.Size = new System.Drawing.Size(90, 28); this.btnRedo.Size = new System.Drawing.Size(80, 23);
this.btnRedo.TabIndex = 36; this.btnRedo.TabIndex = 36;
this.btnRedo.Text = "Redo"; this.btnRedo.Text = "Redo";
this.btnRedo.UseVisualStyleBackColor = false; this.btnRedo.UseVisualStyleBackColor = false;
@@ -463,92 +502,43 @@
// //
this.btnUndo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); 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.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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnUndo.Location = new System.Drawing.Point(104, 6); 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.Name = "btnUndo";
this.btnUndo.Size = new System.Drawing.Size(90, 28); this.btnUndo.Size = new System.Drawing.Size(80, 23);
this.btnUndo.TabIndex = 35; this.btnUndo.TabIndex = 35;
this.btnUndo.Text = "Undo"; this.btnUndo.Text = "Undo";
this.btnUndo.UseVisualStyleBackColor = false; this.btnUndo.UseVisualStyleBackColor = false;
this.btnUndo.Click += new System.EventHandler(this.btnUndo_Click); this.btnUndo.Click += new System.EventHandler(this.btnUndo_Click);
// //
// lsbTools
//
this.lsbTools.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.lsbTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lsbTools.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.lsbTools.FormattingEnabled = true;
this.lsbTools.ItemHeight = 20;
this.lsbTools.Location = new System.Drawing.Point(10, 33);
this.lsbTools.Name = "lsbTools";
this.lsbTools.Size = new System.Drawing.Size(179, 122);
this.lsbTools.TabIndex = 32;
this.lsbTools.SelectedIndexChanged += new System.EventHandler(this.lsbTools_SelectedIndexChanged);
//
// panel1 // panel1
// //
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.btnClear); this.panel1.Controls.Add(this.btnClear);
this.panel1.Controls.Add(this.btnRedo); this.panel1.Controls.Add(this.btnRedo);
this.panel1.Controls.Add(this.btnUndo); this.panel1.Controls.Add(this.btnUndo);
this.panel1.Location = new System.Drawing.Point(920, 575); this.panel1.Location = new System.Drawing.Point(832, 553);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 72); this.panel1.Size = new System.Drawing.Size(178, 60);
this.panel1.TabIndex = 35; this.panel1.TabIndex = 35;
// //
// panel2
//
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.lsbTools);
this.panel2.Location = new System.Drawing.Point(920, 205);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 175);
this.panel2.TabIndex = 36;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label1.Location = new System.Drawing.Point(8, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(108, 20);
this.label1.TabIndex = 36;
this.label1.Text = "Paint tools";
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(41)))), ((int)(((byte)(41)))));
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button2.Font = new System.Drawing.Font("Cascadia Code", 10.2F);
this.button2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214)))));
this.button2.Location = new System.Drawing.Point(9, -195);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(177, 35);
this.button2.TabIndex = 33;
this.button2.Text = "ColorPicker";
this.button2.UseVisualStyleBackColor = false;
//
// panel3 // panel3
// //
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panel3.BackColor = System.Drawing.Color.Transparent; this.panel3.BackColor = System.Drawing.Color.Transparent;
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label3); this.panel3.Controls.Add(this.label3);
this.panel3.Controls.Add(this.pnlLayers);
this.panel3.Controls.Add(this.btnLayerRemove);
this.panel3.Controls.Add(this.BtnAddLayer);
this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.label2);
this.panel3.Controls.Add(this.button1); this.panel3.Location = new System.Drawing.Point(1014, 242);
this.panel3.Controls.Add(this.listBox1); this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel3.Location = new System.Drawing.Point(920, 384);
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(200, 175); this.panel3.Size = new System.Drawing.Size(196, 259);
this.panel3.TabIndex = 37; this.panel3.TabIndex = 37;
// //
// label3 // label3
@@ -556,55 +546,121 @@
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label3.Location = new System.Drawing.Point(8, 10); this.label3.Location = new System.Drawing.Point(3, 8);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(135, 20); this.label3.Size = new System.Drawing.Size(49, 16);
this.label3.TabIndex = 37; this.label3.TabIndex = 37;
this.label3.Text = "Drawing Layers"; this.label3.Text = "Layers";
//
// pnlLayers
//
this.pnlLayers.AutoScroll = true;
this.pnlLayers.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pnlLayers.Location = new System.Drawing.Point(5, 26);
this.pnlLayers.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pnlLayers.Name = "pnlLayers";
this.pnlLayers.Size = new System.Drawing.Size(184, 189);
this.pnlLayers.TabIndex = 39;
//
// btnLayerRemove
//
this.btnLayerRemove.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnLayerRemove.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnLayerRemove.Font = new System.Drawing.Font("Cascadia Code", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnLayerRemove.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnLayerRemove.Location = new System.Drawing.Point(111, 219);
this.btnLayerRemove.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnLayerRemove.Name = "btnLayerRemove";
this.btnLayerRemove.Size = new System.Drawing.Size(78, 35);
this.btnLayerRemove.TabIndex = 38;
this.btnLayerRemove.Text = "-";
this.btnLayerRemove.UseVisualStyleBackColor = false;
this.btnLayerRemove.Click += new System.EventHandler(this.btnLayerRemove_Click);
//
// BtnAddLayer
//
this.BtnAddLayer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.BtnAddLayer.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.BtnAddLayer.Font = new System.Drawing.Font("Cascadia Code", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.BtnAddLayer.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.BtnAddLayer.Location = new System.Drawing.Point(3, 219);
this.BtnAddLayer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.BtnAddLayer.Name = "BtnAddLayer";
this.BtnAddLayer.Size = new System.Drawing.Size(78, 35);
this.BtnAddLayer.TabIndex = 37;
this.BtnAddLayer.Text = "+";
this.BtnAddLayer.UseVisualStyleBackColor = false;
this.BtnAddLayer.Click += new System.EventHandler(this.BtnAddLayer_Click);
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Cascadia Code", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 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(8, 10); this.label2.Location = new System.Drawing.Point(7, 8);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(0, 20); this.label2.Size = new System.Drawing.Size(0, 16);
this.label2.TabIndex = 36; this.label2.TabIndex = 36;
// //
// button1 // DebugLabel1
// //
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.DebugLabel1.AutoSize = true;
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(41)))), ((int)(((byte)(41)))), ((int)(((byte)(41))))); this.DebugLabel1.Location = new System.Drawing.Point(17, 64);
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.DebugLabel1.Name = "DebugLabel1";
this.button1.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.DebugLabel1.Size = new System.Drawing.Size(48, 14);
this.button1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); this.DebugLabel1.TabIndex = 38;
this.button1.Location = new System.Drawing.Point(9, -195); this.DebugLabel1.Text = "Debug";
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(177, 35);
this.button1.TabIndex = 33;
this.button1.Text = "ColorPicker";
this.button1.UseVisualStyleBackColor = false;
// //
// listBox1 // panel4
// //
this.listBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.panel4.BackColor = System.Drawing.Color.Transparent;
this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel4.Controls.Add(this.btnEyeDrop);
this.listBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.panel4.Controls.Add(this.btnRandomColor);
this.listBox1.FormattingEnabled = true; this.panel4.Controls.Add(this.btnColorPicker);
this.listBox1.ItemHeight = 20; this.panel4.Controls.Add(this.btnColorHistory1);
this.listBox1.Location = new System.Drawing.Point(10, 33); this.panel4.Controls.Add(this.btnColorHistory2);
this.listBox1.Name = "listBox1"; this.panel4.Controls.Add(this.btnColorHistory4);
this.listBox1.Size = new System.Drawing.Size(179, 122); this.panel4.Controls.Add(this.btnColorHistory3);
this.listBox1.TabIndex = 32; this.panel4.Location = new System.Drawing.Point(503, 6);
this.panel4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(507, 39);
this.panel4.TabIndex = 37;
//
// btnSvgExport
//
this.btnSvgExport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnSvgExport.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSvgExport.Font = new System.Drawing.Font("Cascadia Code", 10.2F);
this.btnSvgExport.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnSvgExport.Location = new System.Drawing.Point(1014, 505);
this.btnSvgExport.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnSvgExport.Name = "btnSvgExport";
this.btnSvgExport.Size = new System.Drawing.Size(196, 33);
this.btnSvgExport.TabIndex = 37;
this.btnSvgExport.Text = "Export SVG";
this.btnSvgExport.UseVisualStyleBackColor = false;
this.btnSvgExport.Click += new System.EventHandler(this.btnSvgExport_Click);
//
// DebugLabel2
//
this.DebugLabel2.AutoSize = true;
this.DebugLabel2.Location = new System.Drawing.Point(17, 78);
this.DebugLabel2.Name = "DebugLabel2";
this.DebugLabel2.Size = new System.Drawing.Size(48, 14);
this.DebugLabel2.TabIndex = 39;
this.DebugLabel2.Text = "Debug";
// //
// PaintForm // PaintForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34)))));
this.ClientSize = new System.Drawing.Size(1132, 655); this.ClientSize = new System.Drawing.Size(1222, 618);
this.Controls.Add(this.DebugLabel2);
this.Controls.Add(this.btnSvgExport);
this.Controls.Add(this.panel4);
this.Controls.Add(this.DebugLabel1);
this.Controls.Add(this.panel3); this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.panelHoverColor); this.Controls.Add(this.panelHoverColor);
this.Controls.Add(this.panelSelectedColor); this.Controls.Add(this.panelSelectedColor);
@@ -613,12 +669,15 @@
this.Controls.Add(this.panelFile); this.Controls.Add(this.panelFile);
this.Controls.Add(this.canvas); this.Controls.Add(this.canvas);
this.DoubleBuffered = true; this.DoubleBuffered = true;
this.Font = new System.Drawing.Font("Verdana", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214)))));
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.MinimumSize = new System.Drawing.Size(1238, 549);
this.Name = "PaintForm"; this.Name = "PaintForm";
this.Text = "Paint 2"; this.Text = "Paint 2";
this.Load += new System.EventHandler(this.PaintForm_Load); this.Load += new System.EventHandler(this.PaintForm_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PaintForm_KeyDown);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PaintForm_KeyUp);
this.Resize += new System.EventHandler(this.PaintForm_Resize); this.Resize += new System.EventHandler(this.PaintForm_Resize);
((System.ComponentModel.ISupportInitialize)(this.canvas)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.canvas)).EndInit();
this.panelFile.ResumeLayout(false); this.panelFile.ResumeLayout(false);
@@ -634,11 +693,11 @@
this.panelTools.PerformLayout(); this.panelTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbxSample)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxSample)).EndInit();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel3.ResumeLayout(false); this.panel3.ResumeLayout(false);
this.panel3.PerformLayout(); this.panel3.PerformLayout();
this.panel4.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -663,7 +722,6 @@
private System.Windows.Forms.Button btnColorHistory4; private System.Windows.Forms.Button btnColorHistory4;
private System.Windows.Forms.Button btnColorHistory3; private System.Windows.Forms.Button btnColorHistory3;
private System.Windows.Forms.Button btnColorHistory2; private System.Windows.Forms.Button btnColorHistory2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnColorHistory1; private System.Windows.Forms.Button btnColorHistory1;
private System.Windows.Forms.Button btnClear; private System.Windows.Forms.Button btnClear;
private System.Windows.Forms.Panel panelTools; private System.Windows.Forms.Panel panelTools;
@@ -676,15 +734,19 @@
private System.Windows.Forms.Button btnColorPicker; private System.Windows.Forms.Button btnColorPicker;
private System.Windows.Forms.PictureBox pbxSample; private System.Windows.Forms.PictureBox pbxSample;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Button btnLoadFile; private System.Windows.Forms.Button btnLoadFile;
private System.Windows.Forms.Button btnEyeDrop;
private System.Windows.Forms.Button btnLayerRemove;
private System.Windows.Forms.Button BtnAddLayer;
private System.Windows.Forms.Label DebugLabel1;
private System.Windows.Forms.Panel pnlLayers;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Button btnSvgExport;
private System.Windows.Forms.Label DebugLabel2;
} }
} }
+386 -85
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: Class that is controlling the view /// Brief: Class that is controlling the view
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -21,66 +21,60 @@ namespace Paint_2
public partial class PaintForm : Form public partial class PaintForm : Form
{ {
const int WINDOW_OFFSET = 15; const int WINDOW_OFFSET = 15;
const string DEFAULT_FILEPATH = "C:/Paint2/Drawings/"; //readonly Font FONT = new Font("Arial", fontSize);
Color FLAT_RED = Color.FromArgb(0xC6,0x28,0x28); readonly Color FLAT_RED = Color.FromArgb(0xC6, 0x28, 0x28);
Color FLAT_GREEN = Color.FromArgb(0x00,0x89,0x7B); readonly Color FLAT_GREEN = Color.FromArgb(0x00, 0x89, 0x7B);
readonly Color FLAT_GREY1 = Color.FromArgb(0x59, 0x59, 0x59);
private Color _hoveringColor;
private Project _project;
private int _selectedLayer;
private List<string> _selectedLayers;
public Color HoveringColor { get => _hoveringColor; set => _hoveringColor = value; }
public Project Project { get => _project; set => _project = value; }
public int SelectedLayer { get => _selectedLayer; set => _selectedLayer = value; }
public List<string> SelectedLayers { get => _selectedLayers; set => _selectedLayers = value; }
public Sketch sketch;
List<PaintTool> toolList;
bool drawing = false;
bool randomColor = false;
Random rnd;
Color hoveringColor;
public PaintForm() public PaintForm()
{ {
InitializeComponent(); InitializeComponent();
rnd = new Random(); Project = new Project("Untitled project", canvas.Size);
toolList = new List<PaintTool>(); SelectedLayers = new List<string>();
toolList.Add(new Pencil("Default Pencil")); SelectedLayers.Add(Project.GetAllLayers()[0].Id);
toolList.Add(new DotPencil("Dotted Line")); this.KeyPreview = true;
toolList.Add(new BezierPencil("Bezier Generator"));
sketch = new Sketch(new Size(canvas.Width, canvas.Height), toolList);
tmrRefresh.Enabled = true;
RefreshUi(); RefreshUi();
} }
private Point MousePositionToCanvasPosition() private Point MousePositionToCanvasPosition()
{ {
//return new Point(MousePosition.X - canvas.Location.X, MousePosition.Y - canvas.Location.Y);
return canvas.PointToClient(MousePosition); return canvas.PointToClient(MousePosition);
} }
private void canvas_MouseDown(object sender, MouseEventArgs e) private void canvas_MouseDown(object sender, MouseEventArgs e)
{ {
drawing = true; canvas.Focus();
if (randomColor) Color hoveringColor = GetHoverColor();
{ Point mousePosition = MousePositionToCanvasPosition();
sketch.StartDrawing(MousePositionToCanvasPosition(), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)), (int)nupPencilWidth.Value); int toolWidth = (int)nupPencilWidth.Value;
} Project.MouseDown(SelectedLayers, hoveringColor, mousePosition, toolWidth);
else RefreshUi();
{
sketch.StartDrawing(MousePositionToCanvasPosition(), sketch.CurrentTool.Color, (int)nupPencilWidth.Value);
}
} }
private void canvas_MouseUp(object sender, MouseEventArgs e) private void canvas_MouseUp(object sender, MouseEventArgs e)
{ {
sketch.AddDrawingPoint(MousePositionToCanvasPosition()); Point mousePosition = MousePositionToCanvasPosition();
drawing = false; Project.MouseUp(SelectedLayers, mousePosition);
canvas.Image = sketch.StopDrawing((Bitmap)canvas.Image);
RefreshUi(); RefreshUi();
} }
private void tmrRefresh_Tick(object sender, EventArgs e) private void tmrRefresh_Tick(object sender, EventArgs e)
{ {
if (drawing) Point mousePosition = MousePositionToCanvasPosition();
{ Project.TimerTick(SelectedLayers, mousePosition);
sketch.AddDrawingPoint(MousePositionToCanvasPosition());
}
RefreshUi(); RefreshUi();
} }
private void BtnColor_Click(object sender, EventArgs e) private void BtnColor_Click(object sender, EventArgs e)
{ {
Button button = sender as Button; Color newColor = (sender as Button).BackColor;
sketch.ChangePaintToolColor(button.BackColor); Project.ChangeColor(SelectedLayers, newColor);
tmrRefresh_Tick(sender, e); tmrRefresh_Tick(sender, e);
} }
private string ColorToString(Color color) private string ColorToString(Color color)
@@ -89,37 +83,77 @@ namespace Paint_2
string result = ""; string result = "";
result += ColorPicker.ColorToHex(color); result += ColorPicker.ColorToHex(color);
result += " "; result += " ";
result += "R:" + color.R + " G:" + color.G + " B:" + color.B; result += "R:" + color.R + " G:" + color.G + " B:" + color.B + " A:" + color.A;
return result; return result;
} }
private void ForceRefresh() private void ForceRefresh()
{ {
canvas.Image = sketch.ForcePaint(); //canvas.Image = Project.ForcePaintAllLayers();
canvas.Image = Project.ForcePaintLayers();
RefreshUi(); RefreshUi();
} }
private void RefreshUi() private void RefreshUi()
{ {
canvas.Image = sketch.Paint(); lsbTools.DataSource = Project.AvaibleTools;
lblSelectedColor.Text = ColorToString(sketch.CurrentTool.Color); DebugLabel1.Text = "";
btnSelectedColor.BackColor = sketch.CurrentTool.Color;
hoveringColor = GetHoverColor(); PaintTool currentTool = Project.GetCurrentTool(SelectedLayers);
lblHoveringColor.Text = ColorToString(hoveringColor); if (currentTool != null && currentTool.NeedsFullRefresh)
btnHoveringColor.BackColor = hoveringColor; {
canvas.Image = Project.ForcePaintLayers();
}
else
{
canvas.Image = Project.PaintLayers();
}
lblSelectedColor.Text = ColorToString(Project.GetCurrentToolColor(SelectedLayers));
btnSelectedColor.BackColor = Project.GetCurrentToolColor(SelectedLayers);
HoveringColor = GetHoverColor();
lblHoveringColor.Text = ColorToString(HoveringColor);
btnHoveringColor.BackColor = HoveringColor;
List<Color> colorHistory = Project.GetLayerColorHistory(SelectedLayers, 4);
List<Color> colorHistory = sketch.CurrentTool.GetLastColors(4);
btnColorHistory1.BackColor = colorHistory[0]; btnColorHistory1.BackColor = colorHistory[0];
btnColorHistory2.BackColor = colorHistory[1]; btnColorHistory1.ForeColor = colorHistory[0];
btnColorHistory3.BackColor = colorHistory[2];
btnColorHistory4.BackColor = colorHistory[3];
lsbTools.DataSource = toolList; btnColorHistory2.BackColor = colorHistory[1];
btnColorHistory2.ForeColor = colorHistory[1];
btnColorHistory3.BackColor = colorHistory[2];
btnColorHistory3.ForeColor = colorHistory[2];
btnColorHistory4.BackColor = colorHistory[3];
btnColorHistory4.ForeColor = colorHistory[3];
lblWidth.Text = "W: " + canvas.Width.ToString(); lblWidth.Text = "W: " + canvas.Width.ToString();
lblHeight.Text = "H: " + canvas.Height.ToString(); lblHeight.Text = "H: " + canvas.Height.ToString();
pbxSample.Image = DrawSample(pbxSample.Size); pbxSample.Image = DrawSample(pbxSample.Size);
if (randomColor) DebugLabel1.Text = "Control";
DebugLabel2.Text = "Shift";
if (Project.GetCurrentTool(SelectedLayers).IsCtrlPressed)
{
DebugLabel1.ForeColor = Color.Green;
}
else
{
DebugLabel1.ForeColor = Color.Red;
}
if (Project.GetCurrentTool(SelectedLayers).IsShiftPressed)
{
DebugLabel2.ForeColor = Color.Green;
}
else
{
DebugLabel2.ForeColor = Color.Red;
}
if (Project.RandomColor)
{ {
btnRandomColor.BackColor = FLAT_GREEN; btnRandomColor.BackColor = FLAT_GREEN;
} }
@@ -127,14 +161,99 @@ namespace Paint_2
{ {
btnRandomColor.BackColor = FLAT_RED; btnRandomColor.BackColor = FLAT_RED;
} }
if (Project.Eyedropping)
{
btnEyeDrop.BackColor = FLAT_GREEN;
}
else
{
btnEyeDrop.BackColor = FLAT_RED;
}
} }
private Bitmap DrawSample(Size size) private Bitmap DrawSample(Size size)
{ {
Bitmap map = new Bitmap(size.Width, size.Height); Bitmap map = new Bitmap(size.Width, size.Height);
Graphics gr = Graphics.FromImage(map); Graphics gr = Graphics.FromImage(map);
gr.DrawLine(new Pen(sketch.CurrentTool.Color,sketch.CurrentTool.Width),new Point(0,0),new Point(size.Width,size.Height)); if (Project.GetCurrentTool(SelectedLayers) != null)
{
PaintTool currentTool = (PaintTool)Project.GetCurrentTool(SelectedLayers).Clone();
Color paint_tool_color = Project.GetCurrentToolColor(SelectedLayers);
int paint_tool_width = Project.GetCurrentToolWidth(SelectedLayers);
//Would have loved to use a switch case but I cant
if (currentTool is Pencil)
{
Pencil pencil = currentTool as Pencil;
pencil.Start(paint_tool_color, paint_tool_width);
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(paint_tool_color, paint_tool_width);
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;
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);
}
else
{
if (currentTool is RectanglePencil || currentTool is RectangleBorderPencil || currentTool is EllipsePencil || currentTool is EllipseBorderPencil)
{
currentTool.Start(paint_tool_color, paint_tool_width);
currentTool.Add(new Point(0 + size.Width / 10, 0 + size.Height / 10));
currentTool.Add(new Point(size.Width - size.Width / 10, size.Height - size.Height / 10));
currentTool.Stop();
currentTool.Paint(map);
}
}
}
}
}
//gr.DrawLine(new Pen(Project.GetCurrentToolColor(SelectedLayers), Project.GetCurrentToolWidth(SelectedLayers)), new Point(0, 0), new Point(size.Width, size.Height));
return map; return map;
} }
private Color GetHoverColor() private Color GetHoverColor()
@@ -155,13 +274,14 @@ namespace Paint_2
} }
private void btnClear_Click(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e)
{ {
sketch.Clear(); Project.Clear();
ForceRefresh(); ForceRefresh();
} }
private void nupPencilWidth_ValueChanged(object sender, EventArgs e) private void nupPencilWidth_ValueChanged(object sender, EventArgs e)
{ {
sketch.ChangePaintToolWidth((int)nupPencilWidth.Value); int newWidth = (int)nupPencilWidth.Value;
Project.ChangeWidth(SelectedLayers, newWidth);
} }
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
@@ -169,81 +289,262 @@ namespace Paint_2
string fileName = tbxProjectName.Text; string fileName = tbxProjectName.Text;
Bitmap image = (Bitmap)canvas.Image; Bitmap image = (Bitmap)canvas.Image;
if (!Directory.Exists(DEFAULT_FILEPATH)) Project.Save(fileName, image);
{
Directory.CreateDirectory(DEFAULT_FILEPATH);
}
if (!Directory.Exists(DEFAULT_FILEPATH + fileName))
{
Directory.CreateDirectory(DEFAULT_FILEPATH + fileName);
}
image.Save(DEFAULT_FILEPATH + fileName + "/" + fileName + ".png", System.Drawing.Imaging.ImageFormat.Png);
} }
private void btnSaveCopy_Click(object sender, EventArgs e) private void btnSaveCopy_Click(object sender, EventArgs e)
{ {
string fileName = tbxProjectName.Text; string fileName = tbxProjectName.Text;
int version = 1;
Bitmap image = (Bitmap)canvas.Image; Bitmap image = (Bitmap)canvas.Image;
if (!Directory.Exists(DEFAULT_FILEPATH)) Project.SaveCopy(fileName, image);
{
Directory.CreateDirectory(DEFAULT_FILEPATH);
}
if (!Directory.Exists(DEFAULT_FILEPATH + fileName))
{
Directory.CreateDirectory(DEFAULT_FILEPATH + fileName);
}
while (File.Exists(DEFAULT_FILEPATH + fileName + "/" + fileName + version + ".png"))
{
version += 1;
}
image.Save(DEFAULT_FILEPATH + fileName + "/" + fileName + version + ".png", System.Drawing.Imaging.ImageFormat.Png);
} }
private void lsbTools_SelectedIndexChanged(object sender, EventArgs e) private void lsbTools_SelectedIndexChanged(object sender, EventArgs e)
{ {
sketch.ChangeTool(lsbTools.SelectedIndex); 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(); RefreshUi();
} }
private void PaintForm_Resize(object sender, EventArgs e) private void PaintForm_Resize(object sender, EventArgs e)
{ {
canvas.Size = new Size(this.Width - (this.Width - panelTools.Location.X) - canvas.Location.X - WINDOW_OFFSET, this.Height - (this.Height - panelHoverColor.Location.Y) - WINDOW_OFFSET - (panelFile.Location.Y + panelFile.Height)); canvas.Size = new Size(this.Width - (this.Width - panelTools.Location.X) - canvas.Location.X - WINDOW_OFFSET, this.Height - (this.Height - panelHoverColor.Location.Y) - WINDOW_OFFSET - (panelFile.Location.Y + panelFile.Height));
sketch.Resize(canvas.Size); Project.Resize(canvas.Size);
RefreshUi(); RefreshUi();
} }
private void btnRandomColor_Click(object sender, EventArgs e) private void btnRandomColor_Click(object sender, EventArgs e)
{ {
randomColor = !randomColor; Project.SwitchRandom();
RefreshUi();
}
private void btnEyeDrop_Click(object sender, EventArgs e)
{
Project.SwitchEyeDrop();
RefreshUi(); RefreshUi();
} }
private void btnUndo_Click(object sender, EventArgs e) private void btnUndo_Click(object sender, EventArgs e)
{ {
sketch.Undo(); Project.Undo(SelectedLayers);
ForceRefresh(); ForceRefresh();
} }
private void btnRedo_Click(object sender, EventArgs e) private void btnRedo_Click(object sender, EventArgs e)
{ {
sketch.Redo(); Project.Redo(SelectedLayers);
ForceRefresh(); ForceRefresh();
} }
private void btnColorPicker_Click(object sender, EventArgs e) private void btnColorPicker_Click(object sender, EventArgs e)
{ {
ColorPicker cp = new ColorPicker(this); ColorPicker cp = new ColorPicker(this);
//ColorDialog cd = new ColorDialog();
cp.Show(); cp.Show();
//cd.ShowDialog();
} }
private void PaintForm_Load(object sender, EventArgs e) private void PaintForm_Load(object sender, EventArgs e)
{ {
tmrRefresh.Enabled = true;
DisplayLayers();
}
private void btnLayerRemove_Click(object sender, EventArgs e)
{
int layersCount = SelectedLayers.Count;
List<String> LayersToRemove = new List<string>();
foreach (string layer in SelectedLayers)
{
LayersToRemove.Add(layer);
}
for (int id = layersCount - 1; id >= 0; id--)
{
if (Project.RemoveLayer(LayersToRemove[id]))
{
SelectedLayers.RemoveAt(id);
}
else
{
Console.WriteLine("Could not delete the layer");
}
}
DisplayLayers();
RefreshUi();
}
private void BtnAddLayer_Click(object sender, EventArgs e)
{
SelectedLayers.Add(Project.AddLayer());
DisplayLayers();
RefreshUi();
}
private void DisplayLayers()
{
int Yoffset = 10;
int Xoffset = 10;
float fontSize = 10;
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);
int BtnXoffset = labelWidth;
int ChkXOffset = BtnXoffset + btnWidth /*+ Xoffset*/;
int ChkWidth = (int)(blocSize.Width / 6.0);
pnlLayers.Controls.Clear();
List<Sketch> layers = Project.GetAllLayers();
foreach (Sketch layer in layers)
{
//LABEL LAYER NAME
Label lblName = new Label();
//Style
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);
//Style
//Behaviour
pnlLayers.Controls.Add(lblName);
//Behaviour
//BUTTON VISIBILITY
Button BtnVisbility = new Button();
//Style
BtnVisbility.FlatStyle = FlatStyle.Popup;
BtnVisbility.BackColor = FLAT_GREY1;
BtnVisbility.Location = new Point(BtnXoffset, blocsCount * blocSize.Height + Yoffset / 2);
BtnVisbility.Width = btnWidth;
//Style
//Behaviour
if (Project.LayersToPrint.Contains(layer.Id))
{
BtnVisbility.Text = "Visible";
}
else
{
BtnVisbility.Text = "Invisible";
}
BtnVisbility.Name = "ChkLayerVisible:" + layer.Id;
BtnVisbility.Click += LayerSelection;
pnlLayers.Controls.Add(BtnVisbility);
//Behaviour
//BUTTON LAYER SELECTION
Button chk = new Button();
//Style
chk.Location = new Point(ChkXOffset, blocsCount * blocSize.Height + Yoffset / 2);
chk.AutoSize = false;
chk.Text = "";
chk.FlatStyle = FlatStyle.Popup;
chk.Width = ChkWidth;
chk.Name = "ChkLayerSelected:" + layer.Id;
//Style
//Behaviour
chk.Click += LayerCheck;
if (SelectedLayers.Contains(layer.Id))
{
chk.BackColor = Color.Green;
}
else
{
chk.BackColor = Color.Red;
}
pnlLayers.Controls.Add(chk);
//Behaviour
blocsCount++;
}
}
private void LayerSelection(object sender, EventArgs e)
{
//We know that the button's name is ChkLayerVisible:... ... being the GUID of the layer
Button btn = sender as Button;
string rawId = btn.Name;
string id = rawId.Replace("ChkLayerVisible:", String.Empty);
Project.SwitchLayer(id);
DisplayLayers();
}
private void LayerCheck(object sender, EventArgs e)
{
//We know that the button's name is ChkLayerSelected:... ... being the GUID of the layer
Button btn = sender as Button;
//MessageBox.Show("Btn " + btn.Name + " pressed");
string rawId = btn.Name;
string id = rawId.Replace("ChkLayerSelected:", String.Empty);
//MessageBox.Show("Select or Deslect layer n:"+id);
if (SelectedLayers.Contains(id))
{
SelectedLayers.Remove(id);
}
else
{
SelectedLayers.Add(id);
}
DisplayLayers();
}
private void btnSvgExport_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Custom Description";
if (fbd.ShowDialog() == DialogResult.OK)
{
string SelectedPath = fbd.SelectedPath;
if (Project.SaveSvg(SelectedPath, tbxProjectName.Text))
{
MessageBox.Show("Svg saved at " + SelectedPath);
}
else
{
MessageBox.Show("Ooops, could not save the SVG in " + SelectedPath);
}
}
}
private void PaintForm_KeyPress(object sender, KeyPressEventArgs e)
{
//empty for now
}
private void PaintForm_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.ControlKey:
Project.CtrlDown();
break;
case Keys.ShiftKey:
Project.ShiftDown();
break;
default:
//send the key to the tools
break;
}
}
private void PaintForm_KeyUp(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.ControlKey:
Project.CtrlUp();
break;
case Keys.ShiftKey:
Project.ShiftUp();
break;
default:
//send the key to the tools
break;
}
} }
} }
} }
+7 -3
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: Interface that is here to define what is a paint tool /// Brief: Interface that is here to define what is a paint tool
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -13,7 +13,7 @@ using System.Drawing;
namespace Paint_2 namespace Paint_2
{ {
public interface PaintTool public interface PaintTool : ICloneable
{ {
List<List<Point>> Drawings { get; set; } List<List<Point>> Drawings { get; set; }
List<List<Point>> DrawingsRedo { get; set; } List<List<Point>> DrawingsRedo { get; set; }
@@ -22,17 +22,21 @@ namespace Paint_2
Color Color { get; set; } Color Color { get; set; }
List<int> Widths { get; set; } List<int> Widths { get; set; }
List<int> WidthsRedo { get; set; } List<int> WidthsRedo { get; set; }
bool NeedsFullRefresh { get; set; }
int Width { get; set; } int Width { get; set; }
string Name { get; set; } string Name { get; set; }
bool IsCtrlPressed { get; set; }
bool IsShiftPressed { get; set; }
void Start(Color color, int width); void Start(Color color, int width);
Bitmap Stop(Bitmap bmp); void Stop();
void Add(Point point); void Add(Point point);
void Undo(); void Undo();
void Redo(); void Redo();
void Clear(); void Clear();
List<Color> GetLastColors(int colorNumber); List<Color> GetLastColors(int colorNumber);
void Paint(Bitmap canvas); void Paint(Bitmap canvas);
string PaintSVG();
string ToString(); string ToString();
} }
} }
+32 -2
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A class that groups all the frequently used by painttools methods /// Brief: A class that groups all the frequently used by painttools methods
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -92,6 +92,33 @@ namespace Paint_2
result.Reverse(); result.Reverse();
return result; return result;
} }
public List<Point> ConvertRectangleIntoPositive(bool IsCtrlPressed,Point start, Point end)
{
Point newStart = new Point(start.X, start.Y);
Point newEnd = new Point(end.X, end.Y);
int xDiff = end.X - start.X;
int yDiff = end.Y - start.Y;
Size size = new Size(xDiff, yDiff);
if (xDiff < 0)
{
newStart = new Point(end.X, newStart.Y);
}
if (yDiff < 0)
{
newStart = new Point(newStart.X, end.Y);
}
if (IsCtrlPressed)
{
size = new Size(Math.Max(Math.Abs(xDiff), Math.Abs(yDiff)), Math.Max(Math.Abs(xDiff), Math.Abs(yDiff)));
}
newEnd = new Point(newStart.X + Math.Abs(size.Width), newStart.Y + Math.Abs(size.Height));
return new List<Point> { newStart, newEnd };
}
public Point Lerp(Point start, Point end, float t) public Point Lerp(Point start, Point end, float t)
{ {
int xDiff = end.X - start.X; int xDiff = end.X - start.X;
@@ -101,6 +128,9 @@ namespace Paint_2
Point result = new Point(resultX, resultY); Point result = new Point(resultX, resultY);
return result; return result;
} }
public string StandartPaintSVG(List<List<Point>> Drawings,List<Color> Colors, List<int> Widths)
{
return "COUCOU";
}
} }
} }
+5
View File
@@ -54,6 +54,8 @@
<DependentUpon>ColorPicker.cs</DependentUpon> <DependentUpon>ColorPicker.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="DotPencil.cs" /> <Compile Include="DotPencil.cs" />
<Compile Include="EllipseBorderPencil.cs" />
<Compile Include="EllipsePencil.cs" />
<Compile Include="Form1.cs"> <Compile Include="Form1.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -64,7 +66,10 @@
<Compile Include="PaintToolUtils.cs" /> <Compile Include="PaintToolUtils.cs" />
<Compile Include="Pencil.cs" /> <Compile Include="Pencil.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Project.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RectangleBorderPencil.cs" />
<Compile Include="RectanglePencil.cs" />
<Compile Include="Sketch.cs" /> <Compile Include="Sketch.cs" />
<EmbeddedResource Include="ColorPicker.resx"> <EmbeddedResource Include="ColorPicker.resx">
<DependentUpon>ColorPicker.cs</DependentUpon> <DependentUpon>ColorPicker.cs</DependentUpon>
+50 -4
View File
@@ -2,7 +2,7 @@
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: Paint tool that is kind of the default tool /// Brief: Paint tool that is kind of the default tool
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -20,6 +20,9 @@ namespace Paint_2
private List<List<Point>> _drawings; private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo; private List<List<Point>> _drawingsRedo;
private PaintToolUtils Utils; private PaintToolUtils Utils;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private List<Color> _colors; private List<Color> _colors;
private List<Color> _colorsRedo; private List<Color> _colorsRedo;
private List<int> _widths; private List<int> _widths;
@@ -34,9 +37,12 @@ namespace Paint_2
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; } public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; } public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; } public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public Color Color { get => _color; set => _color = value; } public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; } public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; } public int Width { get => _width; set => _width = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public Pencil(string name) public Pencil(string name)
{ {
@@ -48,6 +54,7 @@ namespace Paint_2
WidthsRedo = new List<int>(); WidthsRedo = new List<int>();
Name = name; Name = name;
Utils = new PaintToolUtils(this); Utils = new PaintToolUtils(this);
NeedsFullRefresh = false;
} }
public void Add(Point point) public void Add(Point point)
{ {
@@ -75,6 +82,37 @@ namespace Paint_2
drawingCounter += 1; drawingCounter += 1;
} }
} }
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
//foreach (List<Point> drawing in Drawings)
for (int drawCount = 0; drawCount < Drawings.Count; drawCount++)
{
Point p1;
Point p2;
List<Point> drawing = Drawings[drawCount];
Color color = Colors[drawCount];
int width = Widths[drawCount];
for (int pointIndex = 0; pointIndex < drawing.Count; pointIndex++)
{
if (pointIndex >= 1)
{
p1 = drawing[pointIndex - 1];
p2 = drawing[pointIndex];
result += "<ellipse cx=\"" + p2.X + "\" cy=\"" + p2.Y + "\" rx=\"" + width/2 + "\" ry=\"" + width/2 + "\" style=\"fill:rgb(" + color.R + ", " + color.G + ", " + color.B + ");\"/>";
result += newLine;
result += "<line x1=\"" + p1.X + "\" y1=\"" + p1.Y + "\" x2=\"" + p2.X + "\" y2=\"" + p2.Y + "\" style=\"stroke: rgb(" + color.R + ", " + color.G + ", " + color.B + "); stroke-width:" + width + "\"/>";
result += newLine;
}
}
}
return result;
}
public void Start(Color color, int width) public void Start(Color color, int width)
{ {
Utils.StandartStart(color, width); Utils.StandartStart(color, width);
@@ -83,14 +121,12 @@ namespace Paint_2
{ {
Utils.StandartClear(); Utils.StandartClear();
} }
public Bitmap Stop(Bitmap bmp) public void Stop()
{ {
for (int i = 0; i < Drawings.Count; i++) for (int i = 0; i < Drawings.Count; i++)
{ {
List<Point> Drawing = Drawings[i]; List<Point> Drawing = Drawings[i];
//bmp = PostProcessing(Drawing, bmp, Widths[i]);
} }
return bmp;
} }
private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color) private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color)
{ {
@@ -114,5 +150,15 @@ namespace Paint_2
{ {
Utils.StandartRedo(); Utils.StandartRedo();
} }
public object Clone()
{
Pencil result = new Pencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
} }
} }
+485
View File
@@ -0,0 +1,485 @@
/// file: Project.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A controller that manipulates that gives the view all the info it needs and controlls the layers and tools
/// Version: 0.1.0
/// Date: 17/06/2022
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Paint_2
{
public class Project
{
const string DEFAULT_FILEPATH = "C:/Paint2/Drawings/";
readonly Color DEFAULT_COLOR = Color.Firebrick;
const int DEFAULT_WIDTH = 0;
private List<PaintTool> _avaibleTools;
private List<string> _selectedLayers;
private Guid uniqIdGenerator;
private List<Sketch> _layers;
private bool _eyedropping;
private bool _randomColor;
private Size _canvasSize;
private Random _random;
private bool _drawing;
private string _name;
public List<PaintTool> AvaibleTools { get => _avaibleTools; set => _avaibleTools = value; }
//public Sketch CurrentLayer { get => _currentSketch; set => _currentSketch = value; }
public List<Sketch> Layers { get => _layers; set => _layers = value; }
public bool Eyedropping { get => _eyedropping; set => _eyedropping = value; }
public bool RandomColor { get => _randomColor; set => _randomColor = value; }
public Size CanvasSize { get => _canvasSize; set => _canvasSize = value; }
public Random Random { get => _random; set => _random = value; }
public bool Drawing { get => _drawing; set => _drawing = value; }
public string Name { get => _name; set => _name = value; }
public List<string> LayersToPrint { get => _selectedLayers; set => _selectedLayers = value; }
public Project(string name, Size canvasSize)
{
Name = name;
CanvasSize = canvasSize;
Random = new Random();
//We set all the avaible tools at first
AvaibleTools = new List<PaintTool>();
AvaibleTools.Add(new Pencil("Default Pencil"));
AvaibleTools.Add(new DotPencil("Dotted Line"));
AvaibleTools.Add(new BezierPencil("Bezier Generator"));
AvaibleTools.Add(new RectanglePencil("Box tool"));
AvaibleTools.Add(new RectangleBorderPencil("Rectangle tool"));
AvaibleTools.Add(new EllipsePencil("Ball tool"));
AvaibleTools.Add(new EllipseBorderPencil("Ellipse tool"));
//We create a single first layer with the default toolSet
Layers = new List<Sketch>();
LayersToPrint = new List<string>();
AddLayer();
LayersToPrint.Add(Layers[0].Id);
}
public string AddLayer()
{
List<PaintTool> newTools = new List<PaintTool>();
foreach (PaintTool tool in AvaibleTools)
{
newTools.Add((PaintTool)tool.Clone());
}
uniqIdGenerator = Guid.NewGuid();
string test = uniqIdGenerator.ToString();
Sketch newSketch = new Sketch(String.Concat("Layer_", Layers.Count + 1), CanvasSize, newTools, uniqIdGenerator.ToString());
Layers.Add(newSketch);
LayersToPrint.Add(newSketch.Id);
RestoreLayerNames();
return (newSketch.Id);
}
private void RestoreLayerNames()
{
//resets all the names to not have multiple layer 3 for example
for (int i = 0; i < Layers.Count; i++)
{
Layers[i].Name = "Layer_" + (i + 1);
}
}
public bool RemoveLayer(string layerId)
{
Sketch layer = FindSketch(Layers, layerId);
if (layer != null)
{
Layers.Remove(layer);
RestoreLayerNames();
return true;
}
else
{
return false;
}
}
public Sketch FindSketch(List<Sketch> layers, string id)
{
foreach (Sketch layer in layers)
{
if (layer.Id == id)
{
return layer;
}
}
return null;
}
public bool IsSketchPresent (List<string> layers, string id)
{
foreach (string layer in layers)
{
if (layer == id)
{
return true;
}
}
return false;
}
public List<Sketch> GetAllLayers()
{
return Layers;
}
public void SwitchLayer(string idLayer)
{
bool present = IsSketchPresent(LayersToPrint,idLayer);
if (present)
{
LayersToPrint.Remove(idLayer);
}
else
{
LayersToPrint.Add(idLayer);
}
}
public void MouseDown(List<string> selectedLayers, Color hoveringColor, Point mousePosition, int toolWidth)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
if (Eyedropping)
{
Color pointedColor = hoveringColor;
if (layer.CurrentTool.Color != pointedColor)
{
layer.ChangePaintToolColor(pointedColor);
}
}
else
{
Drawing = true;
if (RandomColor)
{
layer.StartDrawing(mousePosition, Color.FromArgb(Random.Next(0, 256), Random.Next(0, 256), Random.Next(0, 256)), toolWidth);
}
else
{
layer.StartDrawing(mousePosition, layer.CurrentTool.Color, toolWidth);
}
}
}
}
}
public void MouseUp(List<string> selectedLayers, Point mousePosition)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
if (!Eyedropping)
{
layer.AddDrawingPoint(mousePosition);
Drawing = false;
layer.StopDrawing();
}
}
}
}
public void TimerTick(List<string> selectedLayers, Point mousePosition)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
if (Drawing)
{
layer.AddDrawingPoint(mousePosition);
}
}
}
}
public void ChangeColor(List<string> selectedLayers, Color newColor)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
layer.ChangePaintToolColor(newColor);
}
}
}
public void ChangeWidth(List<string> selectedLayers, int width)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
layer.ChangePaintToolWidth(width);
}
}
}
public void ChangeTool(List<string> selectedLayers, int toolId)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
layer.ChangeTool(toolId);
}
}
}
public Bitmap ForcePaintAllLayers()
{
Bitmap result = new Bitmap(CanvasSize.Width, CanvasSize.Height);
Graphics gr = Graphics.FromImage(result);
foreach (Sketch layer in Layers)
{
gr.DrawImage(layer.ForcePaint(), Point.Empty);
}
return result;
}
public Bitmap ForcePaintLayers()
{
Bitmap result = new Bitmap(CanvasSize.Width, CanvasSize.Height);
Graphics gr = Graphics.FromImage(result);
foreach (string layerId in LayersToPrint)
{
Sketch layer = FindSketch(Layers, layerId);
if (layer != null)
{
gr.DrawImage(layer.ForcePaint(), Point.Empty);
}
}
return result;
}
public Bitmap PaintAllLayers()
{
Bitmap result = new Bitmap(CanvasSize.Width, CanvasSize.Height);
Graphics gr = Graphics.FromImage(result);
foreach (Sketch layer in Layers)
{
gr.DrawImage(layer.Paint(), Point.Empty);
}
return result;
}
public Bitmap PaintLayers()
{
Bitmap result = null;
if (CanvasSize.Width != 0 && CanvasSize.Height != 0)
{
result = new Bitmap(CanvasSize.Width, CanvasSize.Height);
Graphics gr = Graphics.FromImage(result);
foreach (string layerId in LayersToPrint)
{
Sketch layer = FindSketch(Layers, layerId);
if (layer != null)
{
gr.DrawImage(layer.Paint(), Point.Empty);
}
}
}
return result;
}
public void Clear()
{
foreach (Sketch layer in Layers)
{
layer.Clear();
}
}
public PaintTool GetCurrentTool(List<string> selectedLayers)
{
if (Layers.Count == 0 || selectedLayers.Count == 0)
{
return null;
}
else
{
Sketch CurrentLayer = FindSketch(Layers, selectedLayers[0]);
return CurrentLayer.CurrentTool;
}
}
public Color GetCurrentToolColor(List<string> selectedLayers)
{
if (Layers.Count == 0 || selectedLayers.Count == 0)
{
return DEFAULT_COLOR;
}
else
{
//Sketch CurrentLayer = Layers[selectedLayers[0];
Sketch CurrentLayer = FindSketch(Layers,selectedLayers[0]);
return CurrentLayer.CurrentTool.Color;
}
}
public int GetCurrentToolWidth(List<string> selectedLayers)
{
if (selectedLayers.Count == 0)
{
return DEFAULT_WIDTH;
}
Sketch CurrentLayer = FindSketch(Layers, selectedLayers[0]);
return CurrentLayer.CurrentTool.Width;
}
public List<Color> GetLayerColorHistory(List<string> selectedLayers, int colorsCount)
{
if (selectedLayers.Count == 0)
{
List<Color> result = new List<Color>();
for (int i = 0; i < colorsCount; i++)
{
result.Add(DEFAULT_COLOR);
}
return result;
}
Sketch CurrentLayer = FindSketch(Layers, selectedLayers[0]);
return CurrentLayer.CurrentTool.GetLastColors(colorsCount);
}
public void Save(string fileName, Bitmap image)
{
if (!Directory.Exists(DEFAULT_FILEPATH))
{
Directory.CreateDirectory(DEFAULT_FILEPATH);
}
if (!Directory.Exists(DEFAULT_FILEPATH + fileName))
{
Directory.CreateDirectory(DEFAULT_FILEPATH + fileName);
}
image.Save(DEFAULT_FILEPATH + fileName + "/" + fileName + ".png", System.Drawing.Imaging.ImageFormat.Png);
}
public void SaveCopy(string fileName, Bitmap image)
{
int version = 1;
if (!Directory.Exists(DEFAULT_FILEPATH))
{
Directory.CreateDirectory(DEFAULT_FILEPATH);
}
if (!Directory.Exists(DEFAULT_FILEPATH + fileName))
{
Directory.CreateDirectory(DEFAULT_FILEPATH + fileName);
}
while (File.Exists(DEFAULT_FILEPATH + fileName + "/" + fileName + version + ".png"))
{
version += 1;
}
image.Save(DEFAULT_FILEPATH + fileName + "/" + fileName + version + ".png", System.Drawing.Imaging.ImageFormat.Png);
}
public void Resize(Size newSize)
{
CanvasSize = newSize;
foreach (Sketch layer in Layers)
{
layer.Resize(CanvasSize);
}
}
public void SwitchRandom()
{
RandomColor = !RandomColor;
}
public void SwitchEyeDrop()
{
Eyedropping = !Eyedropping;
}
public void Undo(List<string> selectedLayers)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
layer.Undo();
}
}
}
public void Redo(List<string> selectedLayers)
{
foreach (string id in selectedLayers)
{
Sketch layer = FindSketch(Layers, id);
if (layer != null)
{
layer.Redo();
}
}
}
public string PrintAllLayers()
{
string result = "";
foreach (Sketch layer in Layers)
{
result += layer.Name;
result += Environment.NewLine;
}
return result;
}
public void CtrlDown()
{
foreach (Sketch layer in Layers)
{
layer.CtrlDown();
}
}
public void CtrlUp()
{
foreach (Sketch layer in Layers)
{
layer.CtrlUp();
}
}
public void ShiftDown()
{
foreach (Sketch layer in Layers)
{
layer.ShiftDown();
}
}
public void ShiftUp()
{
foreach (Sketch layer in Layers)
{
layer.ShiftUp();
}
}
public string ConvertToSVG()
{
string fileContent = "";
string newLine = Environment.NewLine;
fileContent += "<svg version=\"1.1\" width=\"100%\" viewbox=\"0 0 "+CanvasSize.Width+" "+CanvasSize.Height+"\" xmlns = \"http://www.w3.org/2000/svg\">";
fileContent += newLine;
foreach (Sketch layer in Layers)
{
fileContent += "<!-- "+layer.Name+" -->";
fileContent += newLine;
fileContent += layer.PaintSVG();
}
fileContent += newLine;
fileContent += "</svg>";
return fileContent;
}
public bool SaveSvg(string path,string fileName)
{
bool result = false;
if (Directory.Exists(path))
{
using (StreamWriter sw = File.CreateText(path + "\\" + fileName + ".svg"))
{
sw.WriteLine(ConvertToSVG());
result = true;
}
}
return result;
}
}
}
+177
View File
@@ -0,0 +1,177 @@
/// file: RectangleBorderPencil.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A tool that paints the outline of a rectangle
/// Version: 0.1.0
/// Date: 17/06/2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Paint_2
{
internal class RectangleBorderPencil:PaintTool
{
private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private PaintToolUtils Utils;
private List<Color> _colors;
private List<Color> _colorsRedo;
private List<int> _widths;
private List<int> _widthsRedo;
private Color _color;
private string _name;
private int _width;
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; }
public RectangleBorderPencil(string name)
{
NeedsFullRefresh = true;
Drawings = new List<List<Point>>();
DrawingsRedo = new List<List<Point>>();
Colors = new List<Color>();
ColorsRedo = new List<Color>();
Widths = new List<int>();
WidthsRedo = new List<int>();
Name = name;
Utils = new PaintToolUtils(this);
}
public void Add(Point point)
{
List<Point> myDrawing = Drawings[Drawings.Count - 1];
if (myDrawing.Count == 0 || myDrawing.Count == 1)
{
myDrawing.Add(point);
}
else
{
myDrawing[1] = point;
}
Drawings[Drawings.Count - 1] = myDrawing;
}
public void Paint(Bitmap canvas)
{
Graphics gr = Graphics.FromImage(canvas);
int drawingCounter = 0;
Size pointSize;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
start = points[0];
end = points[1];
gr.DrawRectangle(new Pen(Colors[drawingCounter], Widths[drawingCounter]), new Rectangle(start, new Size(end.X - start.X, end.Y - start.Y)));
}
drawingCounter++;
}
}
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
int drawingCounter = 0;
Size pointSize;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
Point start = drawing[0];
Point end = drawing[1];
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
result += "<rect x=\"" + start.X + "\" y=\"" + start.Y + "\" width=\"" + (end.X - start.X) + "\" height=\"" + (end.Y - start.Y) + "\" style=\"stroke:rgb(" + Colors[drawingCounter].R + ", " + Colors[drawingCounter].G + ", " + Colors[drawingCounter].B + ");\" stroke-width=\""+ Widths[drawingCounter]+"\" fill=\"none\"/>";
result += newLine;
}
drawingCounter++;
}
return result;
}
public void Start(Color color, int width)
{
Utils.StandartStart(color, width);
}
public void Clear()
{
Utils.StandartClear();
}
public void Stop()
{
List<Point> myDrawing = Drawings.Last();
Drawings[Drawings.Count - 1] = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, myDrawing[0], myDrawing[1]);
}
private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color)
{
return bmp;
}
public List<Color> GetLastColors(int colorNumber)
{
return Utils.SandartGetLastColors(colorNumber);
}
public override string ToString()
{
return Name;
}
public void Undo()
{
Utils.StandartUndo();
}
public void Redo()
{
Utils.StandartRedo();
}
public object Clone()
{
RectangleBorderPencil result = new RectangleBorderPencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
}
}
+167
View File
@@ -0,0 +1,167 @@
/// file: RectanglePencil.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: A tool that paints a Rectangle
/// Version: 0.1.0
/// Date: 17/06/2022
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Paint_2
{
internal class RectanglePencil:PaintTool
{
private List<List<Point>> _drawings;
private List<List<Point>> _drawingsRedo;
private bool _needsFullRefresh;
private bool _isShiftPressed;
private bool _isCtrlPressed;
private PaintToolUtils Utils;
private List<Color> _colors;
private List<Color> _colorsRedo;
private List<int> _widths;
private List<int> _widthsRedo;
private Color _color;
private string _name;
private int _width;
public List<List<Point>> Drawings { get => _drawings; set => _drawings = value; }
public List<List<Point>> DrawingsRedo { get => _drawingsRedo; set => _drawingsRedo = value; }
public bool NeedsFullRefresh { get => _needsFullRefresh; set => _needsFullRefresh = value; }
public List<Color> Colors { get => _colors; set => _colors = value; }
public List<Color> ColorsRedo { get => _colorsRedo; set => _colorsRedo = value; }
public List<int> Widths { get => _widths; set => _widths = value; }
public List<int> WidthsRedo { get => _widthsRedo; set => _widthsRedo = value; }
public Color Color { get => _color; set => _color = value; }
public string Name { get => _name; set => _name = value; }
public int Width { get => _width; set => _width = value; }
public bool IsShiftPressed { get => _isShiftPressed; set => _isShiftPressed = value; }
public bool IsCtrlPressed { get => _isCtrlPressed; set => _isCtrlPressed = value; }
public RectanglePencil(string name)
{
NeedsFullRefresh = true;
Drawings = new List<List<Point>>();
DrawingsRedo = new List<List<Point>>();
Colors = new List<Color>();
ColorsRedo = new List<Color>();
Widths = new List<int>();
WidthsRedo = new List<int>();
Name = name;
Utils = new PaintToolUtils(this);
}
public void Add(Point point)
{
List<Point> myDrawing = Drawings[Drawings.Count - 1];
if (myDrawing.Count == 0 || myDrawing.Count == 1)
{
myDrawing.Add(point);
}
else
{
myDrawing[1] = point;
}
Drawings[Drawings.Count - 1] = myDrawing;
}
public void Paint(Bitmap canvas)
{
Graphics gr = Graphics.FromImage(canvas);
int drawingCounter = 0;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
List<Point> points;
if (drawingCounter == Drawings.Count - 1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
gr.FillRectangle(new SolidBrush(Colors[drawingCounter]), new Rectangle(points[0], new Size(points[1].X - points[0].X, points[1].Y - points[0].Y)));
}
drawingCounter++;
}
}
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
int drawingCounter = 0;
foreach (List<Point> drawing in Drawings)
{
if (drawing.Count == 2)
{
List<Point> points;
if (drawingCounter == Drawings.Count -1)
{
points = Utils.ConvertRectangleIntoPositive(IsCtrlPressed, drawing[0], drawing[1]);
}
else
{
points = Utils.ConvertRectangleIntoPositive(false, drawing[0], drawing[1]);
}
Point start = points[0];
Point end = points[1];
result += "<rect x=\"" + start.X + "\" y=\"" + start.Y + "\" width=\"" + (end.X - start.X) + "\" height=\"" + (end.Y - start.Y) + "\" style=\"fill:rgb(" + Colors[drawingCounter].R + ", " + Colors[drawingCounter].G + ", " + Colors[drawingCounter].B + ");\"/>";
result += newLine;
}
drawingCounter++;
}
return result;
}
public void Start(Color color, int width)
{
Utils.StandartStart(color, width);
}
public void Clear()
{
Utils.StandartClear();
}
public void Stop()
{
List<Point> myDrawing = Drawings.Last();
Drawings[Drawings.Count - 1] = Utils.ConvertRectangleIntoPositive(IsCtrlPressed,myDrawing[0], myDrawing[1]);
}
private Bitmap PostProcessing(List<Point> Drawing, Bitmap bmp, int width, Color color)
{
return bmp;
}
public List<Color> GetLastColors(int colorNumber)
{
return Utils.SandartGetLastColors(colorNumber);
}
public override string ToString()
{
return Name;
}
public void Undo()
{
Utils.StandartUndo();
}
public void Redo()
{
Utils.StandartRedo();
}
public object Clone()
{
RectanglePencil result = new RectanglePencil(Name);
result.Width = Width;
result.Color = Color;
return (Object)(result);
}
}
}
+49 -7
View File
@@ -1,8 +1,8 @@
/// file: Sketch.cs /// file: Sketch.cs
/// Author: Maxime Rohmer <maxluligames@gmail.com> /// Author: Maxime Rohmer <maxluligames@gmail.com>
/// Brief: Class that is used to store and controll the tools and the bitmap /// Brief: This is a layer wich can controll a set of tools and is controlled by the Project
/// Version: 0.1.0 /// Version: 0.1.0
/// Date: 08/06/2022 /// Date: 17/06/2022
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -20,6 +20,7 @@ namespace Paint_2
bool _isDrawing; bool _isDrawing;
Bitmap _drawing; Bitmap _drawing;
Size _sketchSize; Size _sketchSize;
string id;
string _name; string _name;
internal List<PaintTool> ToolList { get => _toolList; set => _toolList = value; } internal List<PaintTool> ToolList { get => _toolList; set => _toolList = value; }
public PaintTool CurrentTool { get => _currentTool; set => _currentTool = value; } public PaintTool CurrentTool { get => _currentTool; set => _currentTool = value; }
@@ -27,10 +28,13 @@ namespace Paint_2
public Bitmap Drawing { get => _drawing; set => _drawing = value; } public Bitmap Drawing { get => _drawing; set => _drawing = value; }
public Size SketchSize { get => _sketchSize; set => _sketchSize = value; } public Size SketchSize { get => _sketchSize; set => _sketchSize = value; }
public string Name { get => _name; set => _name = value; } public string Name { get => _name; set => _name = value; }
public string Id { get => id; set => id = value; }
public Sketch(Size sketchSize, List<PaintTool> toolList) public Sketch(string name, Size sketchSize, List<PaintTool> toolList, string guid)
{ {
IsDrawing = false; IsDrawing = false;
Id = guid;
Name = name;
SketchSize = sketchSize; SketchSize = sketchSize;
Drawing = new Bitmap(SketchSize.Width, SketchSize.Height); Drawing = new Bitmap(SketchSize.Width, SketchSize.Height);
ToolList = toolList; ToolList = toolList;
@@ -48,7 +52,7 @@ namespace Paint_2
CurrentTool = null; CurrentTool = null;
} }
} }
public Sketch(List<PaintTool> toolList) : this(new Size(500, 500), toolList) public Sketch(List<PaintTool> toolList, string guid) : this("Layer 1", new Size(500, 500), toolList, guid)
{ {
//empty //empty
} }
@@ -92,10 +96,9 @@ namespace Paint_2
{ {
CurrentTool.Start(CurrentTool.Color, width); CurrentTool.Start(CurrentTool.Color, width);
} }
public Bitmap StopDrawing(Bitmap bmp) public void StopDrawing()
{ {
bmp = CurrentTool.Stop(bmp); CurrentTool.Stop();
return bmp;
} }
public void AddDrawingPoint(Point location) public void AddDrawingPoint(Point location)
{ {
@@ -113,6 +116,19 @@ namespace Paint_2
CurrentTool.Paint(Drawing); CurrentTool.Paint(Drawing);
return Drawing; return Drawing;
} }
public string PaintSVG()
{
string result = "";
string newLine = Environment.NewLine;
foreach (PaintTool tool in ToolList)
{
result += "<!-- " + tool.Name + " -->";
result += newLine;
result += tool.PaintSVG();
}
return result;
}
public Bitmap ForcePaint() public Bitmap ForcePaint()
{ {
Drawing = new Bitmap(SketchSize.Width, SketchSize.Height); Drawing = new Bitmap(SketchSize.Width, SketchSize.Height);
@@ -127,5 +143,31 @@ namespace Paint_2
//Todo //Todo
return Color.FromArgb(0x34, 0xF4, 0xFF); return Color.FromArgb(0x34, 0xF4, 0xFF);
} }
public void CtrlDown()
{
if (!CurrentTool.IsCtrlPressed)
{
CurrentTool.IsCtrlPressed = true;
}
}
public void CtrlUp()
{
CurrentTool.IsCtrlPressed = false;
}
public void ShiftDown()
{
if (!CurrentTool.IsShiftPressed)
{
CurrentTool.IsShiftPressed = true;
}
}
public void ShiftUp()
{
CurrentTool.IsShiftPressed = false;
}
public override string ToString()
{
return Name;
}
} }
} }