MCPcopy Create free account
hub / github.com/apohl79/audiogridder / getScreenShotData

Function getScreenShotData

Server/Source/ScreenHelper_linux.cpp:8–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6static Display* display = NULL;
7
8int getScreenShotData(unsigned char** buffer, int x, int y, unsigned int width, unsigned int height) {
9 int ret = 0;
10 if (!display) {
11 display = XOpenDisplay(NULL);
12 }
13
14 if (!display) {
15 // MSG("Fatal: Failed to open X display");
16 return -1;
17 }
18
19 Window win = DefaultRootWindow(display);
20 XImage* img = XGetImage(display, win, x, y, width, height, AllPlanes, ZPixmap);
21 memcpy(*buffer, img->data, width * height * 4);
22 XDestroyImage(img);
23 return ret;
24}
25
26void closeDisplayHandle() {
27 if (display) {

Callers 1

captureScreenNativeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected