int XReadBitmapFile(display, d, filename, width_return, height_return, bitmap_return, x_hot_return,
      Display *display;
      Drawable d;
      char *filename;
      unsigned int *width_return, *height_return;
      Pixmap *bitmap_return;
      int *x_hot_return, *y_hot_return;


display Specifies the connection to the X server.
d Specifies the drawable that indicates the screen.
filename Specifies the file name to use. The format of the file name is operating-system dependent.
Return the width and height values of the read in bitmap file.
bitmap_return Returns the bitmap that is created.
Return the hotspot coordinates.


The XReadBitmapFile() function reads in a file containing a bitmap. The file is parsed in the encoding of the current locale. The ability to read other than the standard format is implementation dependent. If the file cannot be opened, XReadBitmapFile() returns BitmapOpenFailed. If the file can be opened but does not contain valid bitmap data, it returns BitmapFileInvalid. If insufficient working storage is allocated, it returns BitmapNoMemory. If the file is readable and valid, it returns BitmapSuccess.

XReadBitmapFile() returns the bitmap's height and width, as read from the file, to width_return and height_return. It then creates a pixmap of the appropriate size, reads the bitmap data from the file into the pixmap, and assigns the pixmap to the caller's variable bitmap. The caller must free the bitmap using XFreePixmap() when finished. If name_x_hot and name_y_hot exist, XReadBitmapFile() returns them to x_hot_return and y_hot_return; otherwise, it returns -1,-1.

XReadBitmapFile() can generate BadAlloc , BadDrawable , and BadGC 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.

See also

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