簡體   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