Short version:
I need a C# function to paste into my code, that takes a screenshot of a rectangle (x, y, w, l) of the screen using DXGI (assuming it's referenced), because I believe it will do better than Graphics.CopyFromScreen
.
Long version:
I'm writing a game macro in C#, and it uses information from the screen to determine what to do. Specifically, it's repeatedly taking screenshots as Bitmap
s and performs a bunch of GetPixel
s. Right now I'm using Graphics.CopyFromScreen
to get the images, and it's very inconvenient for me, since taking screenshots of an entire screen takes too long, and working with partial screenshots is a whole other task (which I'm currently doing, but I believe it can be done easier).
I tried comparing CopyFromScreen
to unmanaged BitBlt
, both whole screen and small area of it, and the performance is roughly same (I feel like it's the same thing under the hood). Then I found out about SharpDX and screen manipulations related to it. There are a lot of projects that take video from the screen, and a few that take screenshots, but I can't understand the code enough to integrate it into my project. I'm hoping someone can help.
As a side note, the app that I'm taking pictures of uses OpenGL, if that helps.