Pixmap XCreatePixmapFromBitmapData(display, d, data, width, height, fg, bg, depth)
     Display *display;
     Drawable d;
     char *data;
     unsigned int width, height;
     unsigned long fg, bg;
     unsigned int depth;


display Specifies the connection to the X server.
d Specifies the drawable that indicates the screen.
data Specifies the data in bitmap format.
Specify the width and height.
Specify the foreground and background pixel values to use.
depth Specifies the depth of the pixmap.


The XCreatePixmapFromBitmapData() function creates a pixmap of the given depth and then does a bitmap-format XPutImage() of the data into it. The depth must be supported by the screen of the specified drawable, or a BadMatch error results.

XCreatePixmapFromBitmapData() can generate BadAlloc, BadDrawable, BadGC, and BadValue errors.


BadAlloc The server failed to allocate the requested source or server memory.
BadDrawable A value for a Drawable argument does not name a defined Window or Pixmap.
BadGC A value for a GContext argument does not name a defined GContext.
BadMatch An InputOnly window is used as a Drawable.
BadMatch Some argument or pair of arguments has the correct type and range but fails to match in some other way required by the request.

See also

XCreateBitmapFromData(), XCreatePixmap(), XPutImage(), XReadBitmapFile(), XWriteBitmapFile(), "Manipulating Bitmaps".
Christophe Tronche, ch@tronche.com