


XReadBitmapFile(3X11)					XReadBitmapFile(3X11)
X11R5									X11R5



NAME
  XReadBitmapFile, XWriteBitmapFile, XCreatePixmapFromBitmapData, XCreateBit-
  mapFromData -	manipulate bitmaps

SYNTAX
  int XReadBitmapFile(_d_i_s_p_l_a_y, _d, _f_i_l_e_n_a_m_e, _w_i_d_t_h__r_e_t_u_r_n, _h_e_i_g_h_t__r_e_t_u_r_n,
  _b_i_t_m_a_p__r_e_t_u_r_n, _x__h_o_t__r_e_t_u_r_n,
			 _y__h_o_t__r_e_t_u_r_n)
	Display	*_d_i_s_p_l_a_y;
	Drawable _d;
	char *_f_i_l_e_n_a_m_e;
	unsigned int *_w_i_d_t_h__r_e_t_u_r_n, *_h_e_i_g_h_t__r_e_t_u_r_n;
	Pixmap *_b_i_t_m_a_p__r_e_t_u_r_n;
	int *_x__h_o_t__r_e_t_u_r_n, *_y__h_o_t__r_e_t_u_r_n;

  int XWriteBitmapFile(_d_i_s_p_l_a_y,	_f_i_l_e_n_a_m_e, _b_i_t_m_a_p, _w_i_d_t_h, _h_e_i_g_h_t, _x__h_o_t,
  _y__h_o_t)
	Display	*_d_i_s_p_l_a_y;
	char *_f_i_l_e_n_a_m_e;
	Pixmap _b_i_t_m_a_p;
	unsigned int _w_i_d_t_h, _h_e_i_g_h_t;
	int _x__h_o_t, _y__h_o_t;

  Pixmap XCreatePixmapFromBitmapData(_d_i_s_p_l_a_y, _d, _d_a_t_a, _w_i_d_t_h, _h_e_i_g_h_t, _f_g, _b_g,
  _d_e_p_t_h)
       Display *_d_i_s_p_l_a_y;
       Drawable	_d;
       char *_d_a_t_a;
       unsigned	int _w_i_d_t_h, _h_e_i_g_h_t;
       unsigned	long _f_g, _b_g;
       unsigned	int _d_e_p_t_h;

  Pixmap XCreateBitmapFromData(_d_i_s_p_l_a_y,	_d, _d_a_t_a, _w_i_d_t_h,	_h_e_i_g_h_t)
	Display	*_d_i_s_p_l_a_y;
	Drawable _d;
	char *_d_a_t_a;
	unsigned int _w_i_d_t_h, _h_e_i_g_h_t;

ARGUMENTS

  _b_i_t_m_a_p    Specifies the bitmap.

  _b_i_t_m_a_p__r_e_t_u_r_n
	    Returns the	bitmap that is created.

  _d	    Specifies the drawable that	indicates the screen.

  _d_a_t_a	    Specifies the data in bitmap format.

  _d_a_t_a	    Specifies the location of the bitmap data.

  _d_e_p_t_h	    Specifies the depth	of the pixmap.

  _d_i_s_p_l_a_y   Specifies the connection to	the X server.

  _f_g
  _b_g	    Specify the	foreground and background pixel	values to use.

  _f_i_l_e_n_a_m_e  Specifies the file name to use.  The format	of the file name is
	    operating-system dependent.

  _w_i_d_t_h
  _h_e_i_g_h_t    Specify the	width and height.

  _w_i_d_t_h__r_e_t_u_r_n
  _h_e_i_g_h_t__r_e_t_u_r_n
	    Return the width and height	values of the read in bitmap file.

  _x__h_o_t
  _y__h_o_t	    Specify where to place the hotspot coordinates (or -1,-1 if	none
	    are	present) in the	file.

  _x__h_o_t__r_e_t_u_r_n
  _y__h_o_t__r_e_t_u_r_n
	    Return the hotspot coordinates.

DESCRIPTION
  The _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e 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, _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.	If the file can	be
  opened but does not contain valid bitmap data, it returns _B_i_t_m_a_p_F_i_l_e_I_n_-
  _v_a_l_i_d.  If insufficient working storage is allocated,	it returns _B_i_t_m_a_p_-
  _N_o_M_e_m_o_r_y.  If	the file is readable and valid,	it returns _B_i_t_m_a_p_S_u_c_c_e_s_s.

  _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e 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 _X_F_r_e_e_P_i_x_m_a_p when finished.  If _n_a_m_e_x_hot and _n_a_m_e_y_hot
  exist, _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e returns them to x_hot_return and y_hot_return;	oth-
  erwise, it returns -1,-1.

  _X_R_e_a_d_B_i_t_m_a_p_F_i_l_e can generate _B_a_d_A_l_l_o_c	and _B_a_d_D_r_a_w_a_b_l_e	errors.

  The _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e function	writes a bitmap	out to a file in the X ver-
  sion 11 format.  The file is written in the encoding of the current locale.
  If the file cannot be	opened for writing, it returns _B_i_t_m_a_p_O_p_e_n_F_a_i_l_e_d.  If
  insufficient memory is allocated, _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e returns _B_i_t_m_a_p_N_o_M_e_m_o_r_y;
  otherwise, on	no error, it returns _B_i_t_m_a_p_S_u_c_c_e_s_s.  If	x_hot and y_hot	are
  not -1, -1, _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e writes them out as the hotspot coordinates for
  the bitmap.

  _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e can generate	_B_a_d_D_r_a_w_a_b_l_e and	_B_a_d_M_a_t_c_h errors.

  The _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a function creates a pixmap of the given
  depth	and then does a	bitmap-format _X_P_u_t_I_m_a_g_e	of the data into it.  The
  depth	must be	supported by the screen	of the specified drawable, or a	_B_a_d_-
  _M_a_t_c_h	error results.

  _X_C_r_e_a_t_e_P_i_x_m_a_p_F_r_o_m_B_i_t_m_a_p_D_a_t_a can generate _B_a_d_A_l_l_o_c and	_B_a_d_M_a_t_c_h errors.

  The _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a function allows you	to include in your C program
  (using #include) a bitmap file that was written out by _X_W_r_i_t_e_B_i_t_m_a_p_F_i_l_e (X
  version 11 format only) without reading in the bitmap	file.  The following
  example creates a gray bitmap:


  #include "gray.bitmap"
  Pixmap bitmap;
  bitmap = XCreateBitmapFromData(display, window, gray_bits, gray_width, gray_height);

  If insufficient working storage was allocated, _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a
  returns _N_o_n_e.	 It is your responsibility to free the bitmap using
  _X_F_r_e_e_P_i_x_m_a_p when finished.

  _X_C_r_e_a_t_e_B_i_t_m_a_p_F_r_o_m_D_a_t_a	can generate a _B_a_d_A_l_l_o_c	error.

DIAGNOSTICS

  _B_a_d_A_l_l_o_c  The	server failed to allocate the requested	resource or server
	    memory.

  _B_a_d_D_r_a_w_a_b_l_e
	    A value for	a Drawable argument does not name a defined Window or
	    Pixmap.

  _B_a_d_M_a_t_c_h  An _I_n_p_u_t_O_n_l_y window	is used	as a Drawable.

SEE ALSO
  XCreatePixmap(3X11), XPutImage(3X11)
  _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e
















































