Blame man/XReadBitmapFile.man

Packit 5bd3a9
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Permission is hereby granted, free of charge, to any person obtaining
Packit 5bd3a9
.\" a copy of this software and associated documentation files (the
Packit 5bd3a9
.\" "Software"), to deal in the Software without restriction, including
Packit 5bd3a9
.\" without limitation the rights to use, copy, modify, merge, publish,
Packit 5bd3a9
.\" distribute, sublicense, and/or sell copies of the Software, and to
Packit 5bd3a9
.\" permit persons to whom the Software is furnished to do so, subject to
Packit 5bd3a9
.\" the following conditions:
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" The above copyright notice and this permission notice shall be included
Packit 5bd3a9
.\" in all copies or substantial portions of the Software.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit 5bd3a9
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 5bd3a9
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Packit 5bd3a9
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit 5bd3a9
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit 5bd3a9
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit 5bd3a9
.\" OTHER DEALINGS IN THE SOFTWARE.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Except as contained in this notice, the name of the X Consortium shall
Packit 5bd3a9
.\" not be used in advertising or otherwise to promote the sale, use or
Packit 5bd3a9
.\" other dealings in this Software without prior written authorization
Packit 5bd3a9
.\" from the X Consortium.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Packit 5bd3a9
.\" Digital Equipment Corporation
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Portions Copyright \(co 1990, 1991 by
Packit 5bd3a9
.\" Tektronix, Inc.
Packit 5bd3a9
.\"
Packit 5bd3a9
.\" Permission to use, copy, modify and distribute this documentation for
Packit 5bd3a9
.\" any purpose and without fee is hereby granted, provided that the above
Packit 5bd3a9
.\" copyright notice appears in all copies and that both that copyright notice
Packit 5bd3a9
.\" and this permission notice appear in all copies, and that the names of
Packit 5bd3a9
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
Packit 5bd3a9
.\" to this documentation without specific, written prior permission.
Packit 5bd3a9
.\" Digital and Tektronix makes no representations about the suitability
Packit 5bd3a9
.\" of this documentation for any purpose.
Packit 5bd3a9
.\" It is provided ``as is'' without express or implied warranty.
Packit 5bd3a9
.\" 
Packit 5bd3a9
.\"
Packit 5bd3a9
.ds xT X Toolkit Intrinsics \- C Language Interface
Packit 5bd3a9
.ds xW Athena X Widgets \- C Language X Toolkit Interface
Packit 5bd3a9
.ds xL Xlib \- C Language X Interface
Packit 5bd3a9
.ds xC Inter-Client Communication Conventions Manual
Packit 5bd3a9
.na
Packit 5bd3a9
.de Ds
Packit 5bd3a9
.nf
Packit 5bd3a9
.\\$1D \\$2 \\$1
Packit 5bd3a9
.ft CW
Packit 5bd3a9
.\".ps \\n(PS
Packit 5bd3a9
.\".if \\n(VS>=40 .vs \\n(VSu
Packit 5bd3a9
.\".if \\n(VS<=39 .vs \\n(VSp
Packit 5bd3a9
..
Packit 5bd3a9
.de De
Packit 5bd3a9
.ce 0
Packit 5bd3a9
.if \\n(BD .DF
Packit 5bd3a9
.nr BD 0
Packit 5bd3a9
.in \\n(OIu
Packit 5bd3a9
.if \\n(TM .ls 2
Packit 5bd3a9
.sp \\n(DDu
Packit 5bd3a9
.fi
Packit 5bd3a9
..
Packit 5bd3a9
.de IN		\" send an index entry to the stderr
Packit 5bd3a9
..
Packit 5bd3a9
.de Pn
Packit 5bd3a9
.ie t \\$1\fB\^\\$2\^\fR\\$3
Packit 5bd3a9
.el \\$1\fI\^\\$2\^\fP\\$3
Packit 5bd3a9
..
Packit 5bd3a9
.de ZN
Packit 5bd3a9
.ie t \fB\^\\$1\^\fR\\$2
Packit 5bd3a9
.el \fI\^\\$1\^\fP\\$2
Packit 5bd3a9
..
Packit 5bd3a9
.de hN
Packit 5bd3a9
.ie t <\fB\\$1\fR>\\$2
Packit 5bd3a9
.el <\fI\\$1\fP>\\$2
Packit 5bd3a9
..
Packit 5bd3a9
.ny0
Packit 5bd3a9
.TH XReadBitmapFile __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
Packit 5bd3a9
.SH NAME
Packit 5bd3a9
XReadBitmapFile, XReadBitmapFileData, XWriteBitmapFile, XCreatePixmapFromBitmapData, XCreateBitmapFromData \- manipulate bitmaps
Packit 5bd3a9
.SH SYNTAX
Packit 5bd3a9
.HP
Packit 5bd3a9
int XReadBitmapFile(\^Display *\fIdisplay\fP\^, Drawable \fId\fP\^, char
Packit 5bd3a9
*\fIfilename\fP\^, unsigned int *\fIwidth_return\fP, unsigned int
Packit 5bd3a9
*\fIheight_return\fP\^, Pixmap *\fIbitmap_return\fP\^, int
Packit 5bd3a9
*\fIx_hot_return\fP, int *\fIy_hot_return\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
int XReadBitmapFileData(\^char *\fIfilename\fP\^, unsigned int
Packit 5bd3a9
*\fIwidth_return\fP, unsigned int *\fIheight_return\fP\^, unsigned char
Packit 5bd3a9
*\fIdata_return\fP\^, int *\fIx_hot_return\fP, int *\fIy_hot_return\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
int XWriteBitmapFile(\^Display *\fIdisplay\fP\^, char *\fIfilename\fP\^,
Packit 5bd3a9
Pixmap \fIbitmap\fP\^, unsigned int \fIwidth\fP, unsigned int \fIheight\fP\^,
Packit 5bd3a9
int \fIx_hot\fP, int \fIy_hot\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
Pixmap XCreatePixmapFromBitmapData\^(\^Display *\fIdisplay\fP\^, Drawable
Packit 5bd3a9
\fId\fP\^, char *\fIdata\fP\^, unsigned int \fIwidth\fP, unsigned int
Packit 5bd3a9
\fIheight\fP\^, unsigned long \fIfg\fP, unsigned long \fIbg\fP\^, unsigned int
Packit 5bd3a9
\fIdepth\fP\^); 
Packit 5bd3a9
.HP
Packit 5bd3a9
Pixmap XCreateBitmapFromData(\^Display *\fIdisplay\fP\^, Drawable \fId\fP\^,
Packit 5bd3a9
char *\fIdata\fP\^, unsigned int \fIwidth\fP, unsigned int \fIheight\fP\^); 
Packit 5bd3a9
.SH ARGUMENTS
Packit 5bd3a9
.IP \fIbitmap\fP 1i
Packit 5bd3a9
Specifies the bitmap.
Packit 5bd3a9
.IP \fIbitmap_return\fP 1i
Packit 5bd3a9
Returns the bitmap that is created.
Packit 5bd3a9
.ds Dr \ that indicates the screen
Packit 5bd3a9
.IP \fId\fP 1i
Packit 5bd3a9
Specifies the drawable\*(Dr. 
Packit 5bd3a9
.IP \fIdata\fP 1i
Packit 5bd3a9
Specifies the data in bitmap format.
Packit 5bd3a9
.IP \fIdata\fP 1i
Packit 5bd3a9
Specifies the location of the bitmap data.
Packit 5bd3a9
.IP \fIdata_return\fP 1i
Packit 5bd3a9
Returns the bitmap data.
Packit 5bd3a9
.IP \fIdepth\fP 1i
Packit 5bd3a9
Specifies the depth of the pixmap.
Packit 5bd3a9
.IP \fIdisplay\fP 1i
Packit 5bd3a9
Specifies the connection to the X server.
Packit 5bd3a9
.IP \fIfg\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIbg\fP 1i
Packit 5bd3a9
Specify the foreground and background pixel values to use.
Packit 5bd3a9
.IP \fIfilename\fP 1i
Packit 5bd3a9
Specifies the file name to use.
Packit 5bd3a9
The format of the file name is operating-system dependent.
Packit 5bd3a9
.IP \fIwidth\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIheight\fP 1i
Packit 5bd3a9
Specify the width and height.
Packit 5bd3a9
.IP \fIwidth_return\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIheight_return\fP 1i
Packit 5bd3a9
Return the width and height values of the read in bitmap file.
Packit 5bd3a9
.IP \fIx_hot\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIy_hot\fP 1i
Packit 5bd3a9
Specify where to place the hotspot coordinates (or \-1,\-1 if none are present)
Packit 5bd3a9
in the file.
Packit 5bd3a9
.IP \fIx_hot_return\fP 1i
Packit 5bd3a9
.br
Packit 5bd3a9
.ns
Packit 5bd3a9
.IP \fIy_hot_return\fP 1i
Packit 5bd3a9
Return the hotspot coordinates.
Packit 5bd3a9
.SH DESCRIPTION
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XReadBitmapFile
Packit 5bd3a9
function reads in a file containing a bitmap.
Packit 5bd3a9
The file is parsed in the encoding of the current locale.
Packit 5bd3a9
The ability to read other than the standard format 
Packit 5bd3a9
is implementation-dependent.
Packit 5bd3a9
If the file cannot be opened, 
Packit 5bd3a9
.ZN XReadBitmapFile 
Packit 5bd3a9
returns 
Packit 5bd3a9
.ZN BitmapOpenFailed .  
Packit 5bd3a9
If the file can be opened but does not contain valid bitmap data, 
Packit 5bd3a9
it returns 
Packit 5bd3a9
.ZN BitmapFileInvalid .  
Packit 5bd3a9
If insufficient working storage is allocated,
Packit 5bd3a9
it returns
Packit 5bd3a9
.ZN BitmapNoMemory .  
Packit 5bd3a9
If the file is readable and valid,
Packit 5bd3a9
it returns 
Packit 5bd3a9
.ZN BitmapSuccess .
Packit 5bd3a9
.LP
Packit 5bd3a9
.ZN XReadBitmapFile 
Packit 5bd3a9
returns the bitmap's height and width, as read
Packit 5bd3a9
from the file, to width_return and height_return.
Packit 5bd3a9
It then creates a pixmap of the appropriate size, 
Packit 5bd3a9
reads the bitmap data from the file into the pixmap,
Packit 5bd3a9
and assigns the pixmap to the caller's variable bitmap.  
Packit 5bd3a9
The caller must free the bitmap using 
Packit 5bd3a9
.ZN XFreePixmap 
Packit 5bd3a9
when finished.
Packit 5bd3a9
If \fIname\fP_x_hot and \fIname\fP_y_hot exist,
Packit 5bd3a9
.ZN XReadBitmapFile 
Packit 5bd3a9
returns them to x_hot_return and y_hot_return;
Packit 5bd3a9
otherwise, it returns \-1,\-1.
Packit 5bd3a9
.LP
Packit 5bd3a9
.ZN XReadBitmapFile
Packit 5bd3a9
can generate
Packit 5bd3a9
.ZN BadAlloc
Packit 5bd3a9
and
Packit 5bd3a9
.ZN BadDrawable
Packit 5bd3a9
errors.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XReadBitmapFileData
Packit 5bd3a9
function reads in a file containing a bitmap, in the same manner as
Packit 5bd3a9
.ZN XReadBitmapFile ,
Packit 5bd3a9
but returns the data directly rather than creating a pixmap in the server.
Packit 5bd3a9
The bitmap data is returned in data_return; the client must free this
Packit 5bd3a9
storage when finished with it by calling
Packit 5bd3a9
.ZN XFree .
Packit 5bd3a9
The status and other return values are the same as for
Packit 5bd3a9
.ZN XReadBitmapFile .
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XWriteBitmapFile
Packit 5bd3a9
function writes a bitmap out to a file in the X Version 11 format.
Packit 5bd3a9
The name used in the output file is derived from the file name
Packit 5bd3a9
by deleting the directory prefix.
Packit 5bd3a9
The file is written in the encoding of the current locale.
Packit 5bd3a9
If the file cannot be opened for writing, 
Packit 5bd3a9
it returns 
Packit 5bd3a9
.ZN BitmapOpenFailed .  
Packit 5bd3a9
If insufficient memory is allocated,
Packit 5bd3a9
.ZN XWriteBitmapFile
Packit 5bd3a9
returns
Packit 5bd3a9
.ZN BitmapNoMemory ;
Packit 5bd3a9
otherwise, on no error,
Packit 5bd3a9
it returns
Packit 5bd3a9
.ZN BitmapSuccess .
Packit 5bd3a9
If x_hot and y_hot are not \-1, \-1, 
Packit 5bd3a9
.ZN XWriteBitmapFile
Packit 5bd3a9
writes them out as the hotspot coordinates for the bitmap.
Packit 5bd3a9
.LP
Packit 5bd3a9
.ZN XWriteBitmapFile
Packit 5bd3a9
can generate
Packit 5bd3a9
.ZN BadDrawable
Packit 5bd3a9
and
Packit 5bd3a9
.ZN BadMatch
Packit 5bd3a9
errors.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XCreatePixmapFromBitmapData
Packit 5bd3a9
function creates a pixmap of the given depth and then does a bitmap-format
Packit 5bd3a9
.ZN XPutImage
Packit 5bd3a9
of the data into it.
Packit 5bd3a9
The depth must be supported by the screen of the specified drawable,
Packit 5bd3a9
or a
Packit 5bd3a9
.ZN BadMatch
Packit 5bd3a9
error results.
Packit 5bd3a9
.LP
Packit 5bd3a9
.ZN XCreatePixmapFromBitmapData
Packit 5bd3a9
can generate
Packit 5bd3a9
.ZN BadAlloc
Packit 5bd3a9
and
Packit 5bd3a9
.ZN BadMatch
Packit 5bd3a9
errors.
Packit 5bd3a9
.LP
Packit 5bd3a9
The
Packit 5bd3a9
.ZN XCreateBitmapFromData
Packit 5bd3a9
function allows you to include in your C program (using
Packit 5bd3a9
.ZN #include )
Packit 5bd3a9
a bitmap file that was written out by
Packit 5bd3a9
.ZN XWriteBitmapFile
Packit 5bd3a9
(X version 11 format only) without reading in the bitmap file.
Packit 5bd3a9
The following example creates a gray bitmap:
Packit 5bd3a9
.LP
Packit 5bd3a9
.Ds 0
Packit 5bd3a9
\&#include "gray.bitmap"
Packit 5bd3a9
.sp 6p
Packit 5bd3a9
Pixmap bitmap;
Packit 5bd3a9
bitmap = XCreateBitmapFromData(display, window, gray_bits, gray_width, gray_height);
Packit 5bd3a9
.De
Packit 5bd3a9
.LP
Packit 5bd3a9
If insufficient working storage was allocated,
Packit 5bd3a9
.ZN XCreateBitmapFromData
Packit 5bd3a9
returns
Packit 5bd3a9
.ZN None .
Packit 5bd3a9
It is your responsibility to free the
Packit 5bd3a9
bitmap using
Packit 5bd3a9
.ZN XFreePixmap
Packit 5bd3a9
when finished.
Packit 5bd3a9
.LP
Packit 5bd3a9
.ZN XCreateBitmapFromData
Packit 5bd3a9
can generate a
Packit 5bd3a9
.ZN BadAlloc
Packit 5bd3a9
error.
Packit 5bd3a9
.SH DIAGNOSTICS
Packit 5bd3a9
.TP 1i
Packit 5bd3a9
.ZN BadAlloc
Packit 5bd3a9
The server failed to allocate the requested resource or server memory.
Packit 5bd3a9
.TP 1i
Packit 5bd3a9
.ZN BadDrawable
Packit 5bd3a9
A value for a Drawable argument does not name a defined Window or Pixmap.
Packit 5bd3a9
.TP 1i
Packit 5bd3a9
.ZN BadMatch
Packit 5bd3a9
An
Packit 5bd3a9
.ZN InputOnly
Packit 5bd3a9
window is used as a Drawable.
Packit 5bd3a9
.SH "SEE ALSO"
Packit 5bd3a9
XCreatePixmap(__libmansuffix__),
Packit 5bd3a9
XPutImage(__libmansuffix__)
Packit 5bd3a9
.br
Packit 5bd3a9
\fI\*(xL\fP