gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 20:54:36 24 4
gpt4 key购买 nike

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

关于c++ - X11/Xlib.h 中缺少 XGetPixel() 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38554986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com