Blame man/XCreateColormap.man

Packit Service dc579d
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1994, 1996 X Consortium
Packit Service dc579d
.\"
Packit Service dc579d
.\" Permission is hereby granted, free of charge, to any person obtaining
Packit Service dc579d
.\" a copy of this software and associated documentation files (the
Packit Service dc579d
.\" "Software"), to deal in the Software without restriction, including
Packit Service dc579d
.\" without limitation the rights to use, copy, modify, merge, publish,
Packit Service dc579d
.\" distribute, sublicense, and/or sell copies of the Software, and to
Packit Service dc579d
.\" permit persons to whom the Software is furnished to do so, subject to
Packit Service dc579d
.\" the following conditions:
Packit Service dc579d
.\"
Packit Service dc579d
.\" The above copyright notice and this permission notice shall be included
Packit Service dc579d
.\" in all copies or substantial portions of the Software.
Packit Service dc579d
.\"
Packit Service dc579d
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Packit Service dc579d
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit Service dc579d
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Packit Service dc579d
.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
Packit Service dc579d
.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Packit Service dc579d
.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Packit Service dc579d
.\" OTHER DEALINGS IN THE SOFTWARE.
Packit Service dc579d
.\"
Packit Service dc579d
.\" Except as contained in this notice, the name of the X Consortium shall
Packit Service dc579d
.\" not be used in advertising or otherwise to promote the sale, use or
Packit Service dc579d
.\" other dealings in this Software without prior written authorization
Packit Service dc579d
.\" from the X Consortium.
Packit Service dc579d
.\"
Packit Service dc579d
.\" Copyright \(co 1985, 1986, 1987, 1988, 1989, 1990, 1991 by
Packit Service dc579d
.\" Digital Equipment Corporation
Packit Service dc579d
.\"
Packit Service dc579d
.\" Portions Copyright \(co 1990, 1991 by
Packit Service dc579d
.\" Tektronix, Inc.
Packit Service dc579d
.\"
Packit Service dc579d
.\" Permission to use, copy, modify and distribute this documentation for
Packit Service dc579d
.\" any purpose and without fee is hereby granted, provided that the above
Packit Service dc579d
.\" copyright notice appears in all copies and that both that copyright notice
Packit Service dc579d
.\" and this permission notice appear in all copies, and that the names of
Packit Service dc579d
.\" Digital and Tektronix not be used in in advertising or publicity pertaining
Packit Service dc579d
.\" to this documentation without specific, written prior permission.
Packit Service dc579d
.\" Digital and Tektronix makes no representations about the suitability
Packit Service dc579d
.\" of this documentation for any purpose.
Packit Service dc579d
.\" It is provided ``as is'' without express or implied warranty.
Packit Service dc579d
.\" 
Packit Service dc579d
.\"
Packit Service dc579d
.ds xT X Toolkit Intrinsics \- C Language Interface
Packit Service dc579d
.ds xW Athena X Widgets \- C Language X Toolkit Interface
Packit Service dc579d
.ds xL Xlib \- C Language X Interface
Packit Service dc579d
.ds xC Inter-Client Communication Conventions Manual
Packit Service dc579d
.na
Packit Service dc579d
.de Ds
Packit Service dc579d
.nf
Packit Service dc579d
.\\$1D \\$2 \\$1
Packit Service dc579d
.ft CW
Packit Service dc579d
.\".ps \\n(PS
Packit Service dc579d
.\".if \\n(VS>=40 .vs \\n(VSu
Packit Service dc579d
.\".if \\n(VS<=39 .vs \\n(VSp
Packit Service dc579d
..
Packit Service dc579d
.de De
Packit Service dc579d
.ce 0
Packit Service dc579d
.if \\n(BD .DF
Packit Service dc579d
.nr BD 0
Packit Service dc579d
.in \\n(OIu
Packit Service dc579d
.if \\n(TM .ls 2
Packit Service dc579d
.sp \\n(DDu
Packit Service dc579d
.fi
Packit Service dc579d
..
Packit Service dc579d
.de IN		\" send an index entry to the stderr
Packit Service dc579d
..
Packit Service dc579d
.de Pn
Packit Service dc579d
.ie t \\$1\fB\^\\$2\^\fR\\$3
Packit Service dc579d
.el \\$1\fI\^\\$2\^\fP\\$3
Packit Service dc579d
..
Packit Service dc579d
.de ZN
Packit Service dc579d
.ie t \fB\^\\$1\^\fR\\$2
Packit Service dc579d
.el \fI\^\\$1\^\fP\\$2
Packit Service dc579d
..
Packit Service dc579d
.de hN
Packit Service dc579d
.ie t <\fB\\$1\fR>\\$2
Packit Service dc579d
.el <\fI\\$1\fP>\\$2
Packit Service dc579d
..
Packit Service dc579d
.ny0
Packit Service dc579d
.TH XCreateColormap __libmansuffix__ __xorgversion__ "XLIB FUNCTIONS"
Packit Service dc579d
.SH NAME
Packit Service dc579d
XCreateColormap, XCopyColormapAndFree, XFreeColormap, XColor \- create, copy, or destroy colormaps and color structure
Packit Service dc579d
.SH SYNTAX
Packit Service dc579d
.HP
Packit Service dc579d
Colormap XCreateColormap\^(\^Display *\fIdisplay\fP\^, Window \fIw\fP\^,
Packit Service dc579d
Visual *\fIvisual\fP\^, int \fIalloc\fP\^);
Packit Service dc579d
.HP
Packit Service dc579d
Colormap XCopyColormapAndFree\^(\^Display *\fIdisplay\fP\^, Colormap
Packit Service dc579d
\fIcolormap\fP\^); 
Packit Service dc579d
.HP
Packit Service dc579d
int XFreeColormap\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^); 
Packit Service dc579d
.SH ARGUMENTS
Packit Service dc579d
.IP \fIalloc\fP 1i
Packit Service dc579d
Specifies the colormap entries to be allocated.
Packit Service dc579d
You can pass 
Packit Service dc579d
.ZN AllocNone 
Packit Service dc579d
or 
Packit Service dc579d
.ZN AllocAll .
Packit Service dc579d
.ds Cm that you want to create, copy, set, or destroy
Packit Service dc579d
.IP \fIcolormap\fP 1i
Packit Service dc579d
Specifies the colormap \*(Cm.
Packit Service dc579d
.IP \fIdisplay\fP 1i
Packit Service dc579d
Specifies the connection to the X server.
Packit Service dc579d
.IP \fIvisual\fP 1i
Packit Service dc579d
Specifies a visual type supported on the screen.
Packit Service dc579d
If the visual type is not one supported by the screen, 
Packit Service dc579d
a
Packit Service dc579d
.ZN BadMatch
Packit Service dc579d
error results.
Packit Service dc579d
.ds Wi on whose screen you want to create a colormap
Packit Service dc579d
.IP \fIw\fP 1i
Packit Service dc579d
Specifies the window \*(Wi.
Packit Service dc579d
.SH DESCRIPTION
Packit Service dc579d
The
Packit Service dc579d
.ZN XCreateColormap
Packit Service dc579d
function creates a colormap of the specified visual type for the screen 
Packit Service dc579d
on which the specified window resides and returns the colormap ID 
Packit Service dc579d
associated with it.
Packit Service dc579d
Note that the specified window is only used to determine the screen.
Packit Service dc579d
.LP
Packit Service dc579d
The initial values of the colormap entries are undefined for the 
Packit Service dc579d
visual classes
Packit Service dc579d
.ZN GrayScale ,
Packit Service dc579d
.ZN PseudoColor ,
Packit Service dc579d
and
Packit Service dc579d
.ZN DirectColor .
Packit Service dc579d
For
Packit Service dc579d
.ZN StaticGray ,
Packit Service dc579d
.ZN StaticColor ,
Packit Service dc579d
and
Packit Service dc579d
.ZN TrueColor ,
Packit Service dc579d
the entries have defined values,
Packit Service dc579d
but those values are specific to the visual and are not defined by X.
Packit Service dc579d
For
Packit Service dc579d
.ZN StaticGray ,
Packit Service dc579d
.ZN StaticColor ,
Packit Service dc579d
and
Packit Service dc579d
.ZN TrueColor ,
Packit Service dc579d
alloc must be
Packit Service dc579d
.ZN AllocNone ,
Packit Service dc579d
or a
Packit Service dc579d
.ZN BadMatch
Packit Service dc579d
error results.
Packit Service dc579d
For the other visual classes,
Packit Service dc579d
if alloc is
Packit Service dc579d
.ZN AllocNone ,
Packit Service dc579d
the colormap initially has no allocated entries,
Packit Service dc579d
and clients can allocate them.
Packit Service dc579d
For information about the visual types,
Packit Service dc579d
see section 3.1.
Packit Service dc579d
.LP
Packit Service dc579d
If alloc is
Packit Service dc579d
.ZN AllocAll ,
Packit Service dc579d
the entire colormap is allocated writable.
Packit Service dc579d
The initial values of all allocated entries are undefined.
Packit Service dc579d
For
Packit Service dc579d
.ZN GrayScale
Packit Service dc579d
and
Packit Service dc579d
.ZN PseudoColor ,
Packit Service dc579d
the effect is as if an
Packit Service dc579d
.ZN XAllocColorCells
Packit Service dc579d
call returned all pixel values from zero to N \- 1,
Packit Service dc579d
where N is the colormap entries value in the specified visual.
Packit Service dc579d
For
Packit Service dc579d
.ZN DirectColor ,
Packit Service dc579d
the effect is as if an
Packit Service dc579d
.ZN XAllocColorPlanes
Packit Service dc579d
call returned a pixel value of zero and red_mask, green_mask, 
Packit Service dc579d
and blue_mask values containing the same bits as the corresponding
Packit Service dc579d
masks in the specified visual.
Packit Service dc579d
However, in all cases,
Packit Service dc579d
none of these entries can be freed by using
Packit Service dc579d
.ZN XFreeColors .
Packit Service dc579d
.LP
Packit Service dc579d
.ZN XCreateColormap
Packit Service dc579d
can generate
Packit Service dc579d
.ZN BadAlloc ,
Packit Service dc579d
.ZN BadMatch ,
Packit Service dc579d
.ZN BadValue ,
Packit Service dc579d
and
Packit Service dc579d
.ZN BadWindow 
Packit Service dc579d
errors.
Packit Service dc579d
.LP
Packit Service dc579d
The
Packit Service dc579d
.ZN XCopyColormapAndFree
Packit Service dc579d
function creates a colormap of the same visual type and for the same screen
Packit Service dc579d
as the specified colormap and returns the new colormap ID.
Packit Service dc579d
It also moves all of the client's existing allocation from the specified
Packit Service dc579d
colormap to the new colormap with their color values intact 
Packit Service dc579d
and their read-only or writable characteristics intact and frees those entries 
Packit Service dc579d
in the specified colormap.
Packit Service dc579d
Color values in other entries in the new colormap are undefined.
Packit Service dc579d
If the specified colormap was created by the client with alloc set to
Packit Service dc579d
.ZN AllocAll ,
Packit Service dc579d
the new colormap is also created with 
Packit Service dc579d
.ZN AllocAll ,
Packit Service dc579d
all color values for all entries are copied from the specified colormap,
Packit Service dc579d
and then all entries in the specified colormap are freed.
Packit Service dc579d
If the specified colormap was not created by the client with
Packit Service dc579d
.ZN AllocAll ,
Packit Service dc579d
the allocations to be moved are all those pixels and planes
Packit Service dc579d
that have been allocated by the client using
Packit Service dc579d
.ZN XAllocColor ,
Packit Service dc579d
.ZN XAllocNamedColor ,
Packit Service dc579d
.ZN XAllocColorCells ,
Packit Service dc579d
or
Packit Service dc579d
.ZN XAllocColorPlanes
Packit Service dc579d
and that have not been freed since they were allocated.
Packit Service dc579d
.LP
Packit Service dc579d
.ZN XCopyColormapAndFree
Packit Service dc579d
can generate
Packit Service dc579d
.ZN BadAlloc
Packit Service dc579d
and
Packit Service dc579d
.ZN BadColor 
Packit Service dc579d
errors.
Packit Service dc579d
.LP
Packit Service dc579d
The
Packit Service dc579d
.ZN XFreeColormap
Packit Service dc579d
function deletes the association between the colormap resource ID 
Packit Service dc579d
and the colormap and frees the colormap storage.
Packit Service dc579d
However, this function has no effect on the default colormap for a screen.
Packit Service dc579d
If the specified colormap is an installed map for a screen,
Packit Service dc579d
it is uninstalled (see
Packit Service dc579d
.ZN XUninstallColormap ).
Packit Service dc579d
If the specified colormap is defined as the colormap for a window (by
Packit Service dc579d
.ZN XCreateWindow ,
Packit Service dc579d
.ZN XSetWindowColormap ,
Packit Service dc579d
or
Packit Service dc579d
.ZN XChangeWindowAttributes ),
Packit Service dc579d
.ZN XFreeColormap
Packit Service dc579d
changes the colormap associated with the window to
Packit Service dc579d
.ZN None 
Packit Service dc579d
and generates a
Packit Service dc579d
.ZN ColormapNotify
Packit Service dc579d
event.
Packit Service dc579d
X does not define the colors displayed for a window with a colormap of
Packit Service dc579d
.ZN None .
Packit Service dc579d
.LP
Packit Service dc579d
.ZN XFreeColormap
Packit Service dc579d
can generate a
Packit Service dc579d
.ZN BadColor 
Packit Service dc579d
error.
Packit Service dc579d
.SH STRUCTURES
Packit Service dc579d
The
Packit Service dc579d
.ZN XColor
Packit Service dc579d
structure contains:
Packit Service dc579d
.LP
Packit Service dc579d
.Ds 0
Packit Service dc579d
typedef struct {
Packit Service dc579d
        unsigned long pixel;    /\&* pixel value */
Packit Service dc579d
        unsigned short red, green, blue;        /\&* rgb values */
Packit Service dc579d
        char flags;     /\&* DoRed, DoGreen, DoBlue */  
Packit Service dc579d
        char pad;
Packit Service dc579d
} XColor;
Packit Service dc579d
.De
Packit Service dc579d
.LP
Packit Service dc579d
The red, green, and blue values are always in the range 0 to 65535
Packit Service dc579d
inclusive, independent of the number of bits actually used in the
Packit Service dc579d
display hardware.
Packit Service dc579d
The server scales these values down to the range used by the hardware.
Packit Service dc579d
Black is represented by (0,0,0), 
Packit Service dc579d
and white is represented by (65535,65535,65535).
Packit Service dc579d
.IN "Color"
Packit Service dc579d
In some functions,
Packit Service dc579d
the flags member controls which of the red, green, and blue members is used 
Packit Service dc579d
and can be the inclusive OR of zero or more of
Packit Service dc579d
.ZN DoRed ,
Packit Service dc579d
.ZN DoGreen ,
Packit Service dc579d
and 
Packit Service dc579d
.ZN DoBlue .
Packit Service dc579d
.SH DIAGNOSTICS
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadAlloc
Packit Service dc579d
The server failed to allocate the requested resource or server memory.
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadColor
Packit Service dc579d
A value for a Colormap argument does not name a defined Colormap.
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadMatch
Packit Service dc579d
An
Packit Service dc579d
.ZN InputOnly
Packit Service dc579d
window is used as a Drawable.
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadMatch
Packit Service dc579d
Some argument or pair of arguments has the correct type and range but fails
Packit Service dc579d
to match in some other way required by the request.
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadValue
Packit Service dc579d
Some numeric value falls outside the range of values accepted by the request.
Packit Service dc579d
Unless a specific range is specified for an argument, the full range defined
Packit Service dc579d
by the argument's type is accepted.  Any argument defined as a set of
Packit Service dc579d
alternatives can generate this error.
Packit Service dc579d
.TP 1i
Packit Service dc579d
.ZN BadWindow
Packit Service dc579d
A value for a Window argument does not name a defined Window.
Packit Service dc579d
.SH "SEE ALSO"
Packit Service dc579d
XAllocColor(__libmansuffix__),
Packit Service dc579d
XChangeWindowAttributes(__libmansuffix__),
Packit Service dc579d
XCreateWindow(__libmansuffix__),
Packit Service dc579d
XQueryColor(__libmansuffix__),
Packit Service dc579d
XStoreColors(__libmansuffix__)
Packit Service dc579d
.br
Packit Service dc579d
\fI\*(xL\fP