refactor: use Fischless

This commit is contained in:
huiyadanli
2023-10-02 18:00:14 +08:00
parent 45e86a7a34
commit bbd8ed5067
32 changed files with 1033 additions and 253 deletions

View File

@@ -0,0 +1,14 @@
namespace Fischless.WindowCapture;
internal static class BitmapExtensions
{
public static Bitmap Crop(this Bitmap src, int x, int y, int width, int height)
{
Rectangle cropRect = new(x, y, width, height);
Bitmap target = new(cropRect.Width, cropRect.Height);
using System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(target);
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height), cropRect, GraphicsUnit.Pixel);
return target;
}
}