mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
GUI桌面环境
This commit is contained in:
19
Gui/Apps/Paint/Tools/CircleBrush.cs
Normal file
19
Gui/Apps/Paint/Tools/CircleBrush.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Cosmos.System;
|
||||
|
||||
namespace CMLeonOS.Gui.Apps.Paint.Tools
|
||||
{
|
||||
internal class CircleBrush : Tool
|
||||
{
|
||||
public CircleBrush() : base("Circle brush")
|
||||
{
|
||||
}
|
||||
|
||||
internal override void Run(Paint paint, Window canvas, MouseState mouseState, int mouseX, int mouseY)
|
||||
{
|
||||
if (mouseState == MouseState.Left)
|
||||
{
|
||||
canvas.DrawCircle(mouseX, mouseY, 5, paint.SelectedColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
42
Gui/Apps/Paint/Tools/Pencil.cs
Normal file
42
Gui/Apps/Paint/Tools/Pencil.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Cosmos.System;
|
||||
|
||||
namespace CMLeonOS.Gui.Apps.Paint.Tools
|
||||
{
|
||||
internal class Pencil : Tool
|
||||
{
|
||||
public Pencil() : base("Pencil")
|
||||
{
|
||||
}
|
||||
|
||||
private bool joinLine;
|
||||
private int joinX;
|
||||
private int joinY;
|
||||
|
||||
internal override void Run(Paint paint, Window canvas, MouseState mouseState, int mouseX, int mouseY)
|
||||
{
|
||||
if (mouseState == MouseState.Left)
|
||||
{
|
||||
if (joinLine)
|
||||
{
|
||||
canvas.DrawLine(joinX, joinY, mouseX, mouseY, paint.SelectedColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas.DrawPoint(mouseX, mouseY, paint.SelectedColor);
|
||||
}
|
||||
joinLine = true;
|
||||
joinX = mouseX;
|
||||
joinY = mouseY;
|
||||
}
|
||||
else
|
||||
{
|
||||
joinLine = false;
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Deselected()
|
||||
{
|
||||
joinLine = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user