X11/Xlib.h 中缺少 XGetPixel()?
Missing XGetPixel() in X11/Xlib.h?
我正在编写一个使用 XGetPixel() 方法的程序。但是,在使用它时我收到一条错误消息 "Error: XGetPixel was not declared in this scope"
我的代码如下:
#include <X11/Xlib.h>
#include <X11/X.h>
#include <unistd.h>
#include <iostream>
using namespace std;
int main()
{
// Open a display.
Display *d = XOpenDisplay(NULL);
// Get the root of the display
Window root = DefaultRootWindow(d);
// Map the root window
XMapWindow(d, root);
// Get width and height of the display
int windowHeight = XDisplayHeight (d, 0);
int windowWidth = XDisplayWidth(d, 0);
// Get dump of screen
XImage *image = XGetImage(d, root, 0, 0, windowWidth, windowHeight, AllPlanes, ZPixmap);
XGetPixel(image,5,5);
return 0;
}
奇怪的是,当我签入 X11/Xlib.h 时,它似乎甚至没有 XGetPixel() 方法或结构。这可能是一个错误吗?我目前正在使用 Ubuntu 16 并使用 apt-get libx11-dev 安装它,但我找不到关于此问题的任何报告问题。
图像处理函数定义在 #include <X11/Xutil.h>
。
我正在编写一个使用 XGetPixel() 方法的程序。但是,在使用它时我收到一条错误消息 "Error: XGetPixel was not declared in this scope"
我的代码如下:
#include <X11/Xlib.h>
#include <X11/X.h>
#include <unistd.h>
#include <iostream>
using namespace std;
int main()
{
// Open a display.
Display *d = XOpenDisplay(NULL);
// Get the root of the display
Window root = DefaultRootWindow(d);
// Map the root window
XMapWindow(d, root);
// Get width and height of the display
int windowHeight = XDisplayHeight (d, 0);
int windowWidth = XDisplayWidth(d, 0);
// Get dump of screen
XImage *image = XGetImage(d, root, 0, 0, windowWidth, windowHeight, AllPlanes, ZPixmap);
XGetPixel(image,5,5);
return 0;
}
奇怪的是,当我签入 X11/Xlib.h 时,它似乎甚至没有 XGetPixel() 方法或结构。这可能是一个错误吗?我目前正在使用 Ubuntu 16 并使用 apt-get libx11-dev 安装它,但我找不到关于此问题的任何报告问题。
图像处理函数定义在 #include <X11/Xutil.h>
。