Reputation: 1315
I'm trying to find the average pixel color of the entire screen or section of the screen in a C/C++ program. For example, say I wanted to find the average pixel color of the coordinate 0,0 to 50, 500?
My goal is to poll the whole screen, and not just one window the background.
If it's very difficult in C/C++, I suppose I could use Python.
Any suggestions for what I can use? Any example code would be greatly appreciated. Thanks :)
Upvotes: 2
Views: 1850
Reputation: 992947
You can use GetDC(NULL)
to get a HDC that refers to the entire screen. You can then use BitBlt
or other pixel-moving function to get the pixels from the screen into a buffer that you can read from.
Upvotes: 1