blob: 51591ec125bb428ff5eece0f870888e29c2fe9f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.ScreenCapture
{
public class GdiScreenCapture : IScreenCaptureMethod
{
public Bitmap GetDesktopBitmap(CaptureRegion region)
{
var bitmap = new Bitmap(region.Width, region.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(region.Left, region.Top, 0, 0, bitmap.Size, System.Drawing.CopyPixelOperation.SourceCopy);
}
return bitmap;
}
public void Dispose()
{
//Do nothing
}
}
}
|