aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs')
-rw-r--r--Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs b/Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs
new file mode 100644
index 000000000..92f4403fd
--- /dev/null
+++ b/Software/Visual_Studio/Tango.RemoteDesktop/CaptureMethods/GdiScreenCapture.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.RemoteDesktop.CaptureMethods
+{
+ /// <summary>
+ /// Represents a standard GDI screen capture method.
+ /// </summary>
+ /// <seealso cref="Tango.RemoteDesktop.ICaptureMethod" />
+ public class GdiScreenCapture : ICaptureMethod
+ {
+ /// <summary>
+ /// Gets the desktop bitmap.
+ /// </summary>
+ /// <param name="region">The capture region.</param>
+ /// <returns></returns>
+ 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;
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources.
+ /// </summary>
+ public void Dispose()
+ {
+ //Do nothing
+ }
+ }
+}