繁体   English   中英

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

[英]Missing XGetPixel() in X11/Xlib.h?

我正在编写一个使用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>中定义。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM