X11 / Xlib.h中缺少XGetPixel()吗?

杰克:

我正在编写一个使用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安装了它,但找不到有关此问题的任何已报告问题。

让·皮埃尔·杜迪(Jean Pierre Dudey):

图像处理功能在处定义#include <X11/Xutil.h>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章