桌面环境:增加环境变量APP并给Paint应用程序增加更多画图工具

This commit is contained in:
2026-03-25 20:08:10 +08:00
parent a0eaf70304
commit a8ac9384c6
11 changed files with 519 additions and 3 deletions

View File

@@ -0,0 +1,53 @@
using Cosmos.System;
using System.Drawing;
namespace CMLeonOS.Gui.Apps.Paint.Tools
{
internal class Eraser : Tool
{
public Eraser() : base("Eraser")
{
}
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, Color.White);
}
for (int y = -4; y <= 4; y++)
{
for (int x = -4; x <= 4; x++)
{
int drawX = mouseX + x;
int drawY = mouseY + y;
if (paint.IsInBounds(drawX, drawY))
{
canvas.DrawPoint(drawX, drawY, Color.White);
}
}
}
joinLine = true;
joinX = mouseX;
joinY = mouseY;
}
else
{
joinLine = false;
}
}
internal override void Deselected()
{
joinLine = false;
}
}
}