


XCreateColormap(3X11)					XCreateColormap(3X11)
X11R5									X11R5



NAME
  XCreateColormap, XCopyColormapAndFree, XFreeColormap,	XColor - create,
  copy,	or destroy colormaps and color structure

SYNTAX

  Colormap XCreateColormap(_d_i_s_p_l_a_y, _w, _v_i_s_u_a_l, _a_l_l_o_c)
	Display	*_d_i_s_p_l_a_y;
	Window _w;
	Visual *_v_i_s_u_a_l;
	int _a_l_l_o_c;

  Colormap XCopyColormapAndFree(_d_i_s_p_l_a_y, _c_o_l_o_r_m_a_p)
	Display	*_d_i_s_p_l_a_y;
	Colormap _c_o_l_o_r_m_a_p;

  XFreeColormap(_d_i_s_p_l_a_y, _c_o_l_o_r_m_a_p)
	Display	*_d_i_s_p_l_a_y;
	Colormap _c_o_l_o_r_m_a_p;

ARGUMENTS

  _a_l_l_o_c	    Specifies the colormap entries to be allocated.  You can pass
	    _A_l_l_o_c_N_o_n_e or _A_l_l_o_c_A_l_l.

  _c_o_l_o_r_m_a_p  Specifies the colormap that	you want to create, copy, set, or
	    destroy.

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

  _v_i_s_u_a_l    Specifies a	visual type supported on the screen.  If the visual
	    type is not	one supported by the screen, a _B_a_d_M_a_t_c_h	error
	    results.

  _w	    Specifies the window on whose screen you want to create a color-
	    map.

DESCRIPTION

  The _X_C_r_e_a_t_e_C_o_l_o_r_m_a_p function creates a colormap of the specified visual
  type for the screen on which the specified window resides and	returns	the
  colormap ID associated with it.  Note	that the specified window is only
  used to determine the	screen.

  The initial values of	the colormap entries are undefined for the visual
  classes _G_r_a_y_S_c_a_l_e, _P_s_e_u_d_o_C_o_l_o_r, and _D_i_r_e_c_t_C_o_l_o_r.  For	_S_t_a_t_i_c_G_r_a_y, _S_t_a_-
  _t_i_c_C_o_l_o_r, and	_T_r_u_e_C_o_l_o_r, the entries have defined values, but	those values
  are specific to the visual and are not defined by X.	For _S_t_a_t_i_c_G_r_a_y,	_S_t_a_-
  _t_i_c_C_o_l_o_r, and	_T_r_u_e_C_o_l_o_r, alloc must be _A_l_l_o_c_N_o_n_e, or a _B_a_d_M_a_t_c_h error
  results.  For	the other visual classes, if alloc is _A_l_l_o_c_N_o_n_e, the colormap
  initially has	no allocated entries, and clients can allocate them.  For
  information about the	visual types, see section 3.1.

  If alloc is _A_l_l_o_c_A_l_l,	the entire colormap is allocated writable.  The	ini-
  tial values of all allocated entries are undefined.  For _G_r_a_y_S_c_a_l_e and
  _P_s_e_u_d_o_C_o_l_o_r, the effect is as	if an _X_A_l_l_o_c_C_o_l_o_r_C_e_l_l_s call returned all
  pixel	values from zero to N -	1, where N is the colormap entries value in
  the specified	visual.	 For _D_i_r_e_c_t_C_o_l_o_r, the effect is	as if an
  _X_A_l_l_o_c_C_o_l_o_r_P_l_a_n_e_s call returned a pixel value	of zero	and red_mask,
  green_mask, and blue_mask values containing the same bits as the
  corresponding	masks in the specified visual.	However, in all	cases, none
  of these entries can be freed	by using _X_F_r_e_e_C_o_l_o_r_s.

  _X_C_r_e_a_t_e_C_o_l_o_r_m_a_p can generate _B_a_d_A_l_l_o_c, _B_a_d_M_a_t_c_h, _B_a_d_V_a_l_u_e, and _B_a_d_W_i_n_d_o_w
  errors.

  The _X_C_o_p_y_C_o_l_o_r_m_a_p_A_n_d_F_r_e_e function creates a colormap of the same visual
  type and for the same	screen as the specified	colormap and returns the new
  colormap ID.	It also	moves all of the client's existing allocation from
  the specified	colormap to the	new colormap with their	color values intact
  and their read-only or writable characteristics intact and frees those
  entries in the specified colormap.  Color values in other entries in the
  new colormap are undefined.  If the specified	colormap was created by	the
  client with alloc set	to _A_l_l_o_c_A_l_l, the new colormap is also created with
  _A_l_l_o_c_A_l_l, all	color values for all entries are copied	from the specified
  colormap, and	then all entries in the	specified colormap are freed.  If the
  specified colormap was not created by	the client with	_A_l_l_o_c_A_l_l, the alloca-
  tions	to be moved are	all those pixels and planes that have been allocated
  by the client	using _X_A_l_l_o_c_C_o_l_o_r, _X_A_l_l_o_c_N_a_m_e_d_C_o_l_o_r, _X_A_l_l_o_c_C_o_l_o_r_C_e_l_l_s, or
  _X_A_l_l_o_c_C_o_l_o_r_P_l_a_n_e_s and	that have not been freed since they were allocated.

  _X_C_o_p_y_C_o_l_o_r_m_a_p_A_n_d_F_r_e_e can generate _B_a_d_A_l_l_o_c and _B_a_d_C_o_l_o_r errors.

  The _X_F_r_e_e_C_o_l_o_r_m_a_p function deletes the association between the colormap
  resource ID and the colormap and frees the colormap storage.	However, this
  function has no effect on the	default	colormap for a screen.	If the speci-
  fied colormap	is an installed	map for	a screen, it is	uninstalled (see _X_U_n_-
  _i_n_s_t_a_l_l_C_o_l_o_r_m_a_p).  If	the specified colormap is defined as the colormap for
  a window (by _X_C_r_e_a_t_e_W_i_n_d_o_w, _X_S_e_t_W_i_n_d_o_w_C_o_l_o_r_m_a_p, or _X_C_h_a_n_g_e_W_i_n_d_o_w_A_t_t_r_i_-
  _b_u_t_e_s), _X_F_r_e_e_C_o_l_o_r_m_a_p	changes	the colormap associated	with the window	to
  _N_o_n_e and generates a _C_o_l_o_r_m_a_p_N_o_t_i_f_y event.  X	does not define	the colors
  displayed for	a window with a	colormap of _N_o_n_e.

  _X_F_r_e_e_C_o_l_o_r_m_a_p	can generate a _B_a_d_C_o_l_o_r	error.

STRUCTURES

  The _X_C_o_l_o_r structure contains:

  typedef struct {
	  unsigned long	pixel;	  /* pixel value */
	  unsigned short red, green, blue;	  /* rgb values	*/
	  char flags;	  /* DoRed, DoGreen, DoBlue */
	  char pad;
  } XColor;

  The red, green, and blue values are always in	the range 0 to 65535
  inclusive, independent of the	number of bits actually	used in	the display
  hardware.  The server	scales these values down to the	range used by the
  hardware.  Black is represented by (0,0,0), white is represented by
  (65535,65535,65535).	In some	functions, the flags member controls which of
  the red, green, and blue members is used and can be the inclusive OR of
  zero or more of _D_o_R_e_d, _D_o_G_r_e_e_n, and _D_o_B_l_u_e.

DIAGNOSTICS

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

  _B_a_d_C_o_l_o_r  A value for	a Colormap argument does not name a defined Colormap.

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

  _B_a_d_M_a_t_c_h  Some argument or pair of arguments has the correct type and	range
	    but	fails to match in some other way required by the request.

  _B_a_d_V_a_l_u_e  Some numeric value falls outside the range of values accepted by
	    the	request.  Unless a specific range is specified for an argu-
	    ment, the full range defined by the	argument's type	is accepted.
	    Any	argument defined as a set of alternatives can generate this
	    error.

  _B_a_d_W_i_n_d_o_w A value for	a Window argument does not name	a defined Window.

SEE ALSO

  XAllocColor(3X11), XChangeWindowAttributes(3X11), XCreateWindow(3X11),
  XQueryColor(3X11), XStoreColors(3X11)
  _X_l_i_b - _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e



















































