Once you have connected to an X server, you can use the Xlib functions to:
Create and free pixmaps
Pixmaps can only be used on the screen on which they were created. Pixmaps are off-screen resources that are used for various operations, for example, defining cursors as tiling patterns or as the source for certain raster operations. Most graphics requests can operate either on a window or on a pixmap. A bitmap is a single bit-plane pixmap.
To create a pixmap of a given size, use XCreatePixmap().
To free all storage associated with a specified pixmap, use XFreePixmap().
XCreatePixmap
Pixmap XCreatePixmap(display, d, width, height