Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.
Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Digital Equipment Corporation
Portions Copyright \(co 1990, 1991 by
Tektronix, Inc.
Permission to use, copy, modify and distribute this documentation for
any purpose and without fee is hereby granted, provided that the above
copyright notice appears in all copies and that both that copyright notice
and this permission notice appear in all copies, and that the names of
Digital and Tektronix not be used in in advertising or publicity pertaining
to this documentation without specific, written prior permission.
Digital and Tektronix makes no representations about the suitability
of this documentation for any purpose.
It is provided "as is" without express or implied warranty.
int XReadBitmapFile(\^Display *display\^, Drawable d\^, _Xconst char *filename\^, unsigned int *width_return, unsigned int *height_return\^, Pixmap *bitmap_return\^, int *x_hot_return, int *y_hot_return\^);
int XReadBitmapFileData(\^_Xconst char *filename\^, unsigned int *width_return, unsigned int *height_return\^, unsigned char **data_return\^, int *x_hot_return, int *y_hot_return\^);
int XWriteBitmapFile(\^Display *display\^, _Xconst char *filename\^, Pixmap bitmap\^, unsigned int width, unsigned int height\^, int x_hot, int y_hot\^);
Pixmap XCreatePixmapFromBitmapData\^(\^Display *display\^, Drawable d\^, char *data\^, unsigned int width, unsigned int height\^, unsigned long fg, unsigned long bg\^, unsigned int depth\^);
Pixmap XCreateBitmapFromData(\^Display *display\^, Drawable d\^, _Xconst char *data\^, unsigned int width, unsigned int height\^);
.ns
.ns
.ns
.ns
.ns
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 and BadDrawable errors.
The XReadBitmapFileData function reads in a file containing a bitmap, in the same manner as XReadBitmapFile , but returns the data directly rather than creating a pixmap in the server. The bitmap data is returned in data_return; the client must free this storage when finished with it by calling XFree . The status and other return values are the same as for XReadBitmapFile .
The XWriteBitmapFile function writes a bitmap out to a file in the X Version 11 format. The name used in the output file is derived from the file name by deleting the directory prefix. The file is written in the encoding of the current locale. If the file cannot be opened for writing, it returns BitmapOpenFailed . If insufficient memory is allocated, XWriteBitmapFile returns BitmapNoMemory ; otherwise, on no error, it returns BitmapSuccess . If x_hot and y_hot are not -1, -1, XWriteBitmapFile writes them out as the hotspot coordinates for the bitmap.
XWriteBitmapFile can generate BadDrawable and BadMatch errors.
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 and BadMatch errors.
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:
.EX #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 error.
1i BadAlloc The server failed to allocate the requested resource or server memory.
1i BadDrawable A value for a Drawable argument does not name a defined Window or Pixmap.
1i BadMatch An InputOnly window is used as a Drawable.
\*(xL