NAME
XCreateBitmapFromData — create a bitmap from X11 bitmap format data.
SYNOPSIS
Pixmap XCreateBitmapFromData(display, drawable, data,
width, height) Display ∗display; Drawable drawable; char ∗data; unsigned int width, height;
ARGUMENTS
displaySpecifies a connection to an X server; returned from XOpenDisplay().
drawableSpecifies a drawable. This determines which screen to create the bitmap on.
dataSpecifies the bitmap data, in X11 bitmap file format.
width
heightSpecify the dimensions in pixels of the created bitmap. If smaller than the bitmap data, the upper-left corner of the data is used.
RETURNS
The created Pixmap.
DESCRIPTION
XCreateBitmapFromData() creates a single-plane pixmap from an array of hexadecimal data. This data may be defined in the program or included (using #include). The bitmap data must be in X version 11 format as shown below (it cannot be in X10 format). The following format is assumed for the data, where the variables are members of the XImage structure described in Volume One, Chapter 6, Drawing Graphics and Text:
format=XYPixmap
bit_order=LSBFirst
byte_order=LSBFirst
bitmap_unit=8
bitmap_pad=8
xoffset=0
no extra bytes per line
XCreateBitmapFromData() creates an image with the specified data and copies it into the created pixmap. The following is an example of creating a bitmap:
#define gray_width 16 #define gray_height 16 #define gray_x_hot 8 #define gray_y_hot 8 static char gray_bits[] = {
0xf8, 0x1f, 0xe3, 0xc7, 0xcf, 0xf3, 0x9f, 0xf9,
0xbf, 0xfd, 0x33, 0xcc, 0x7f, 0xfe, 0x7f, 0xfe,
0x7e, 0x7e, 0x7f, 0xfe, 0x37, 0xec, 0xbb, 0xdd,
0x9c, 0x39, 0xcf, 0xf3, 0xe3, 0xc7, 0xf8, 0x1f};
Pixmap XCreateBitmapFromData(display, window, gray_bits,
gray_width, gray_height);
If the call could not create a pixmap of the requested size on the server, XCreateBitmapFromData() returns None, and the server generates a BadAlloc error. If the requested depth is not supported on the screen of the specified drawable, the server generates a BadMatch error.
The user should free the bitmap using XFreePixmap() when it is no longer needed.
For more information, see Volume One, Chapter 6, Drawing Graphics and Text.
ERRORS
BadAllocServer has insufficient memory to create bitmap.
BadDrawable
BadValueSpecified bitmap dimensions are zero.
SEE ALSO
XCreatePixmap(), XCreatePixmapFromBitmapData(), XCreatePixmapFromBitmapData(), XFreePixmap(), XQueryBestSize(), XQueryBestStipple(), XQueryBestTile(), XReadBitmapFile(), XSetTile(), XSetWindowBackgroundPixmap(), XSetWindowBorderPixmap(), XWriteBitmapFile().
Xlib Reference Manual