使用创建像素图
Pixmap XCreatePixmap(display, d, width, height, depth)
Display *display; // The display
Drawable d; // The Window for which to set the background
为像素图创建图形上下文
GC XCreateGC(display, d, valuemask, values)
将 XImage 绘制到 Pixmap
XPutImage(display, pixmap, gc, image, src_x, src_y, dest_x, dest_y, width, height)
Drawable d; // The Pixmap
XImage *image; // your XImage
最后将 Pixmap 设置为窗口背景
XSetWindowBackgroundPixmap(display, w, background_pixmap)
Display *display;
Window w;
Pixmap background_pixmap;
然后释放不再需要的所有资源。