我正在编写一个使用XGetPixel()方法的程序。但是,使用它时,我收到一条错误消息:“错误:未在此范围内声明XGetPixel”
我的代码如下:
#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>
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句