如何使用 C 的 GTK4 获取屏幕的像素?
How can I use GTK4 of C to get the pixels of the screen?
如何使用 C 的 GTK4 获取屏幕的像素?
如果 GTK4 没有 API,我如何从 Xlib 获取屏幕的像素?
我不知道 GTK4 但在 X11 中:
示例:
//open display and get the root window of the default screen
//note: there could be more than one screen
Display *dpy = XOpenDisplay(NULL);
Window root = RootWindow(dpy, DefaultScreen(dpy));
//get the window attributes of the root window
XWindowAttributes attr;
XGetWindowAttributes(dpy, root, &attr);
//get the image of the root window
XImage* image = XGetImage(
dpy,
root,
0, 0, //attr.x, attr.y
attr.width, attr.height,
AllPlanes,
ZPixmap
);
提示:包含X11/Xlib.h
并用-lX11
编译
如何使用 C 的 GTK4 获取屏幕的像素?
如果 GTK4 没有 API,我如何从 Xlib 获取屏幕的像素?
我不知道 GTK4 但在 X11 中:
示例:
//open display and get the root window of the default screen
//note: there could be more than one screen
Display *dpy = XOpenDisplay(NULL);
Window root = RootWindow(dpy, DefaultScreen(dpy));
//get the window attributes of the root window
XWindowAttributes attr;
XGetWindowAttributes(dpy, root, &attr);
//get the image of the root window
XImage* image = XGetImage(
dpy,
root,
0, 0, //attr.x, attr.y
attr.width, attr.height,
AllPlanes,
ZPixmap
);
提示:包含X11/Xlib.h
并用-lX11