'\"macro stdmacro
.if n .pH g3x11.XSeStandC @(#)XSeStandC	40.3 of 1/19/90
.ds tk X Toolkit
.ds xT X Toolkit Intrinsics \- C Language Interface
.ds xI Intrinsics
.ds xW Athena X Widgets \- C Language X Toolkit Interface
.ds xL Xlib \- C Language X Interface
.ds xC Inter-Client Communication Conventions Manual
.ds Rn 3
.ds Vn 2.2
.hw XtMake-Geometry-Request XtQuery-Geometry wid-get
.na
.de Ds
.nf
.\\$1D \\$2 \\$1
.ft 1
.ps \\n(PS
.\".if \\n(VS>=40 .vs \\n(VSu
.\".if \\n(VS<=39 .vs \\n(VSp
..
.de De
.ce 0
.if \\n(BD .DF
.nr BD 0
.in \\n(OIu
.if \\n(TM .ls 2
.sp \\n(DDu
.fi
..
.de FD
.LP
.KS
.TA .5i 3i
.ta .5i 3i
.nf
..
.de FN
.fi
.KE
.LP
..
.de IN		\" send an index entry to the stderr
.tm \\n%:\\$1:\\$2:\\$3
..
.de C{
.KS
.nf
.D
.\"
.\"	choose appropriate monospace font
.\"	the imagen conditional, 480,
.\"	may be changed to L if LB is too
.\"	heavy for your eyes...
.\"
.ie "\\*(.T"480" .ft L
.el .ie "\\*(.T"300" .ft L
.el .ie "\\*(.T"202" .ft PO
.el .ie "\\*(.T"aps" .ft CW
.el .ft R
.ps \\n(PS
.ie \\n(VS>40 .vs \\n(VSu
.el .vs \\n(VSp
..
.de C}
.DE
.R
..
.de Pn
.ie t \\$1\fB\^\\$2\^\fR\\$3
.el \\$1\fI\^\\$2\^\fP\\$3
..
.de PN
.ie t \fB\^\\$1\^\fR\\$2
.el \fI\^\\$1\^\fP\\$2
..
.de NT
.ne 7
.ds NO Note
.if \\n(.$>$1 .if !'\\$2'C' .ds NO \\$2
.if \\n(.$ .if !'\\$1'C' .ds NO \\$1
.ie n .sp
.el .sp 10p
.TB
.ce
\\*(NO
.ie n .sp
.el .sp 5p
.if '\\$1'C' .ce 99
.if '\\$2'C' .ce 99
.in +5n
.ll -5n
.R
..
.		\" Note End -- doug kraft 3/85
.de NE
.ce 0
.in -5n
.ll +5n
.ie n .sp
.el .sp 10p
..
.ny0
.nr X
.if \nX=0 .ds x} XSetStandardColormap 3X11 "9/1/88" "XWIN 3.0" "\&"
.if \nX=1 .ds x} XSetStandardColormap 3X11 "9/1/88" "XWIN 3.0"
.if \nX=2 .ds x} XSetStandardColormap 3X11 "" "\&"
.if \nX=3 .ds x} XSetStandardColormap "" "" "\&"
.TH \*(x}
.SH NAME
XSetStandardColormap, XGetStandardColormap \- set or get standard colormaps
.SH SYNTAX
XSetStandardColormap(\^\fIdisplay\fP, \fIw\fP, \fIcolormap\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XStandardColormap *\fIcolormap\fP\^;
.br
      Atom \fIproperty\fP\^;	/* RGB_BEST_MAP, etc. */
.LP
Status XGetStandardColormap(\^\fIdisplay\fP, \fIw\fP, \fIcolormap_return\fP, \fIproperty\fP\^)
.br
      Display *\fIdisplay\fP\^;
.br
      Window \fIw\fP\^;
.br
      XStandardColormap *\fIcolormap_return\fP\^;
.br
      Atom \fIproperty\fP\^;	/* RGB_BEST_MAP, etc. */
.SH ARGUMENTS
.\" $Header: cmap.a,v 1.2 88/05/09 06:39:13 mento Exp $
.IP \fIcolormap\fP 1i
Specifies the colormap.
.IP \fIcolormap_return\fP 1i
Returns the colormap associated with the specified atom.
.\" $Header: display.a,v 1.1 88/02/26 10:26:29 mento Exp $
.IP \fIdisplay\fP 1i
Specifies the connection to the X\s-2WIN\s+2 server.
.\" $Header: property.a,v 1.2 88/04/05 15:19:43 mento Exp $
.IP \fIproperty\fP 1i
Specifies the property name.
.\" $Header: w.a,v 1.2 88/05/07 11:35:31 mento Exp $
.IP \fIw\fP 1i
Specifies the window.
.SH DESCRIPTION
.\" $Header: XSetSCmap.d,v 1.3 88/06/11 07:53:28 mento Exp $
The
.PN XSetStandardColormap
function usually is only used by window managers.  
To create a standard colormap, 
follow this procedure:
.IP 1. 5
Open a new connection to the same server.
.IP 2. 5
Grab the server.
.IP 3. 5
See if the property is on the property list of the root window for the screen.
.IP 4. 5
If the desired property is not present:
.RS
.IP \(bu 5
Create a colormap (not required for RGB_DEFAULT_MAP)
.IP \(bu 5
Determine the color capabilities of the display.
.IP \(bu 5
Call 
.PN XAllocColorPlanes
or 
.PN XAllocColorCells
to allocate cells in the colormap.
.IP \(bu 5
Call 
.PN XStoreColors
to store appropriate color values in the colormap.
.IP \(bu 5
Fill in the descriptive members in the 
.PN XStandardColormap
structure.
.IP \(bu 5
Attach the property to the root window.
.IP \(bu 5
Use
.PN XSetCloseDownMode
to make the resource permanent.
.RE
.IP 5. 5
Ungrab the server.
.LP
.ds fd .PN XSetStandardColormap
\*(fd
can generate
.PN BadAlloc ,
.PN BadAtom ,
and
.PN BadWindow 
errors.
.LP
.\" $Header: XGetSCmap.d,v 1.6 88/08/23 17:29:28 mento Exp $
The
.PN XGetStandardColormap
function returns the colormap definition associated with the atom supplied
as the property argument.
For example,
to fetch the standard
.PN GrayScale
colormap for a display,
you use
.PN XGetStandardColormap
with the following syntax:
.LP
.Ds 0
.TA .5i 1.5i
.ta .5i 1.5i
XGetStandardColormap(dpy, DefaultRootWindow(dpy), &cmap, XA_RGB_GRAY_MAP);
.De
.LP
Once you have fetched a standard colormap,
you can use it to convert RGB values into pixel values.
For example, given an
.PN XStandardColormap
structure
and floating-point RGB coefficients in the range 0.0 to 1.0,
you can compose pixel values with the following C expression:
.LP
.Ds 0
.TA .5i 1.5i
.ta .5i 1.5i
pixel = base_pixel
.br
	+ ((unsigned long) (0.5 + r * red_max)) * red_mult
.br
	+ ((unsigned long) (0.5 + g * green_max)) * green_mult
.br
	+ ((unsigned long) (0.5 + b * blue_max)) * blue_mult;
.De
.LP
The use of addition rather than logical OR for composing pixel
values permits allocations where the RGB value is not aligned
to bit boundaries.
.LP
.ds fd .PN XGetStandardColormap
\*(fd
can generate
.PN BadAtom
and
.PN BadWindow 
errors.
.SH DIAGNOSTICS
.\" $Header: badalloc.e,v 1.3 87/09/11 11:17:14 mento Exp $
.TP 1i
.PN BadAlloc
The server failed to allocate the requested resource or server memory.
.\" $Header: badatom.e,v 1.1 87/09/04 08:22:55 mento Exp $
.TP 1i
.PN BadAtom
A value for an Atom argument does not name a defined Atom.
.\" $Header: badwindow.e,v 1.1 87/09/04 08:23:20 mento Exp $
.TP 1i
.PN BadWindow
A value for a Window argument does not name a defined Window.
.SH "SEE ALSO"
\fI\*(xL\fP
