Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

NAME

XWriteBitmapFile − write a bitmap to a file. 

Synopsis

int XWriteBitmapFile(display, filename, bitmap, width,

height, x_hot, y_hot)
Display *display;
char *filename;
Pixmap bitmap;
unsigned int width, height;
int x_hot, y_hot;

Arguments

displaySpecifies a connection to an X server; returned from XOpenDisplay(). 

filenameSpecifies the filename to use.  The format of the filename is operating system specific. 

bitmapSpecifies the bitmap to be written. 

width

heightSpecify the width and height in pixels of the bitmap to be written. 

x_hot

y_hotSpecify where to place the hotspot coordinates (or  − 1, − 1 if none present) in the file. 

Description

XWriteBitmapFile() writes a bitmap to a file.  The file is written out in X version 11 bitmap file format, shown below.  The file is written in the encoding of the current locale.  If the file cannot be opened for writing, XWriteBitmapFile() returns BitmapOpenFailed.  If insufficient memory is allocated XWriteBitmapFile() returns BitmapNoMemory.  Otherwise, on no error, XWriteBitmapFile() returns BitmapSuccess.  If x_hot and y_hot are not  − 1,  − 1, then XWriteBitmapFile() writes them out as the hotspot coordinates for the bitmap.  The following is an example of the contents of a bitmap file created.  The name used ("gray" in this example) is the portion of filename after the last "/". 

#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};
 

For more information on bitmaps, see Volume One, Chapter 6, Drawing Graphics and Text. 

Errors

BadAlloc
 

BadDrawable
 

BadMatchThe specified width and height did not match dimensions of the specified bitmap. 

See Also

XCreateBitmapFromData(), XCreatePixmap(), XCreatePixmapFromBitmapData(), XFreePixmap(), XQueryBestSize(), XQueryBestStipple(), XQueryBestTile(), XReadBitmapFile(), XSetTile(), XSetWindowBackgroundPixmap(), XSetWindowBorderPixmap(). 

Copyright O’Reilly & Assoc.  —  

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026