c - 如何在 Linux 中使用 x-window lib 使图像变暗

标签 c linux ubuntu xlib imaging

我打算在 Ubuntu 中使用 x lib 使图像变暗。这是我的代码。

XImage* getCorrectedImage(Pixmap p){
   int buflen, i;
   XImage* img = XGetImage(g_display, p, 0, 0, g_width, g_height,    AllPlanes, ZPixmap);
   buflen = img->width * img->height * img->bitmap_pad / 8;
   for(i = 0; i < buflen; i++){
      img->data[i] /= 2;
   }
}

结果图像是这样的:

Image

最佳答案

这是颜色模式的问题。它不是 24 位颜色模式 你必须使用 16 位颜色模式

关于c - 如何在 Linux 中使用 x-window lib 使图像变暗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41396971/

相关文章:

c - 在 Linux 中使用 C 实现零 RAM

linux - JavaFXSceneBuilder1.1 未在 Ubuntu Linux 中启动

ubuntu - 无法通过 apt-get 在我的 Ubuntu 9.04 上安装 pip

ubuntu - 如何使用 dotnet 将 .nupkg 推送到私有(private) NuGet 源?

c - 在 Ubuntu Nautilus 浏览器中打开定位特定文件的文件夹

C 编程 - 表达式?

c - 为什么我可以用这个非法的C语句编译而没有任何错误?

c - Inotify:仅监视文件夹内的某些文件

Linux和HADOOP安装在一台机器的一个驱动器上,我可以在电脑的另一个驱动器上安装HDFS吗

linux - 将目录名称附加到文件末尾并移动它们