using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.RemoteDesktop.CaptureMethods
{
///
/// Represents a standard GDI screen capture method.
///
///
public class GdiScreenCapture : ICaptureMethod
{
///
/// Gets the desktop bitmap.
///
/// The capture region.
///
public Bitmap GetDesktopBitmap(CaptureRegion region)
{
var bitmap = new Bitmap(region.Width, region.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(region.Left, region.Top, 0, 0, bitmap.Size, System.Drawing.CopyPixelOperation.SourceCopy);
}
return bitmap;
}
///
/// Releases unmanaged and - optionally - managed resources.
///
public void Dispose()
{
//Do nothing
}
}
}