XCreateBitmapFromData

Syntax

Pixmap XCreateBitmapFromData(display, d, data, width, height)
      Display *display;
      Drawable d;
      char *data;
      unsigned int width, height;

Arguments

display Specifies the connection to the X server.
d Specifies the drawable that indicates the screen.
data Specifies the location of the bitmap data.
width
height
Specify the width and height.

Description

The XCreateBitmapFromData() function allows you to include in your C program (using #include) a bitmap file that was written out by XWriteBitmapFile() (X version 11 format only) without reading in the bitmap file. The following example creates a gray bitmap:


#include "gray.bitmap"

Pixmap bitmap;
bitmap = XCreateBitmapFromData(display, window, gray_bits, gray_width, gray_height);

If insufficient working storage was allocated, XCreateBitmapFromData() returns None. It is your responsibility to free the bitmap using XFreePixmap() when finished.

XCreateBitmapFromData() can generate a BadAlloc and BadGC errors.

Diagnostics

BadAlloc The server failed to allocate the requested source or server memory.
BadGC A value for a GContext argument does not name a defined GContext.

See also

XCreatePixmap(), XCreatePixmapFromBitmapData(), XPutImage(), XReadBitmapFile(), XWriteBitmapFile(), "Manipulating Bitmaps".
Christophe Tronche, [email protected]