Changed the drawing method of the default pencil to remove artefacts at higher widths
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Paint_2
|
|||||||
private void canvas_MouseDown(object sender, MouseEventArgs e)
|
private void canvas_MouseDown(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
drawing = true;
|
drawing = true;
|
||||||
sketch.StartDrawing(MousePositionToCanvasPosition(), Color.FromArgb(rnd.Next(0,256), rnd.Next(0, 256), rnd.Next(0, 256)), 5);
|
sketch.StartDrawing(MousePositionToCanvasPosition(), Color.FromArgb(rnd.Next(0,256), rnd.Next(0, 256), rnd.Next(0, 256)), (int)nupPencilWidth.Value);
|
||||||
tmrRefresh.Enabled = true;
|
tmrRefresh.Enabled = true;
|
||||||
|
|
||||||
//new Thread((sketch) => { (sketch as Sketch).AddDrawingPoint(this.PointToClient(MousePosition)); }).Start();
|
//new Thread((sketch) => { (sketch as Sketch).AddDrawingPoint(this.PointToClient(MousePosition)); }).Start();
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace Paint_2
|
|||||||
{
|
{
|
||||||
Graphics gr = Graphics.FromImage(canvas);
|
Graphics gr = Graphics.FromImage(canvas);
|
||||||
int drawingCounter = 0;
|
int drawingCounter = 0;
|
||||||
|
Size pointSize;
|
||||||
|
|
||||||
foreach (List<Point> drawing in Drawings)
|
foreach (List<Point> drawing in Drawings)
|
||||||
{
|
{
|
||||||
int pointCounter = 0;
|
int pointCounter = 0;
|
||||||
@@ -40,6 +42,8 @@ namespace Paint_2
|
|||||||
{
|
{
|
||||||
if (pointCounter > 0)
|
if (pointCounter > 0)
|
||||||
{
|
{
|
||||||
|
pointSize = new Size(Widths[drawingCounter], Widths[drawingCounter]);
|
||||||
|
gr.FillEllipse(new SolidBrush(Colors[drawingCounter]),new Rectangle(new Point(p.X - pointSize.Width/2,p.Y - pointSize.Height/2), pointSize));
|
||||||
gr.DrawLine(new Pen(Colors[drawingCounter],Widths[drawingCounter]),drawing[pointCounter -1],p);
|
gr.DrawLine(new Pen(Colors[drawingCounter],Widths[drawingCounter]),drawing[pointCounter -1],p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user