Off screen memory (a pixmap) is often used to define images for later use in graphics operations. Pixmaps are also used to define tiles, or patterns, for use as window backgrounds, borders, or cursors. A single bit plane pixmap is sometimes referred to as a bitmap.
To create a Pixmap, use
Pixmap XCreatePixmap(display,d,width,height,depth) unsigned int width, height, depth;To read a bitmap from a file (created by the
bitmapprogram, perhaps), use
int XReadBitmapFile(display,d,filename,width,height,bitmap,x_hot,y_hot) /* possible return values are BitmapOpenFailed, BitmapFileInvalid BitmapNoMemory, BitmapSuccess */ int *width, *height; /*RETURN*/ Pixmap *bitmap; /*RETURN*/ int *x_hot,*y_hot; /*RETURN*/To write a bitmap to a file, use
int XWriteBitmapFile(display,filename,bitmap,width,height,x_hot,y_hot) /* possible return values are BitmapOpenFailed, BitmapNoMemory BitmapSuccess */ int width, height; Pixmap bitmap; int x_hot,y_hot;If you
#includea bitmap file in your program you can use
Pixmap XCreateBitmapFromData(display,d,data,width,height) char *dataPixmaps consume a lot of memory. Use
XFreePixmap(display,pixmap)as soon as possible to release memory.