Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XGetRGBColormaps(3X) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought




XAllocStandardColormap(3X) XAllocStandardColormap(3X)
NAME XAllocStandardColormap, XSetRGBColormaps, XGetRGBColormaps, XStandardColormap - allocate, set, and read an XStandardColormap structure SYNOPSIS XStandardColormap *XAllocStandardColormap() void XSetRGBColormaps(display, w, std-colormap, count, property) Display* display; Window w; XStandardColormap* std-colormap; int count; Atom property; Status XGetRGBColormaps(display, w, std-colormap-return, count-return, property) Display* display; Window w; XStandardColormap **std-colormap-return; int *count-return; Atom property; DESCRIPTION The XAllocStandardColormap function allocates and returns a pointer to a XStandardColormap structure. Note that all members of the XStandardColormap structure are initially set to 0. If insufficient memory is available, XAllocStandardColormap returns NULL. To free the memory al- located to this structure, use XFree. The XSetRGBColormaps function replaces the RGB colormap de- finition in the specified property on the named window. If the property does not already exist, XSetRGBColormaps sets the RGB colormap definition in the specified property on the named window. The property is stored with a type of RGB_COLOR_MAP and a format of 32. Note that it is the caller's responsibility to honor the restriction in Inter- Client Communications Conventions Manual (ICCCM) that only RGB_DEFAULT_MAP contain more than one definition. The XGetRGBColormaps function returns the RGB colormap de- finitions stored in the specified property on the named win- dow. If the property exists, is of type RGB_COLOR_MAP, is of format 32, and is long enough to contain a colormap de- finition (if visualid (see below) is not present, XGetRGBColormaps assumes the default visual for the screen on which the window is located; if killid (see below) is not present, None, which indicates that the resources cannot be released, is assumed), XGetRGBColormaps allocates and fills in space for the returned colormaps, and returns a nonzero November, 1990 1



XAllocStandardColormap(3X) XAllocStandardColormap(3X)
status. Otherwise, none of the fields are set, and XGetRGBColormaps returns a 0 status. Note that it is the caller's responsibility to honor the ICCCM restriction that only RGB_DEFAULT_MAP contain more than one definition. Arguments These functions accept the following arguments: display Specifies the connection to the X server. count Specifies the number of colormaps. count-return Returns the number of colormaps. property Specifies the property name. std-colormap Specifies the XStandardColormap structure to be used. std-colormap-return Returns the XStandardColormap structure. Structures The XStandardColormap structure is defined as follows. /* Hints */ #define ReleaseByFreeingColormap ( (XID) 1L) /* Values */ typedef struct { Colormap colormap; unsigned long red_max; unsigned long red_mult; unsigned long green_max; unsigned long green_mult; unsigned long blue_max; unsigned long blue_mult; unsigned long base_pixel; VisualID visualid; XID killid; } XStandardColormap; The colormap member is the colormap created by the XCreateColormap function. The red_max, green_max, and blue_max members give the maximum red, green, and blue values, respectively. Each color coefficient ranges from 0 to its max, inclusive. For example, a common colormap allo- cation is 3/3/2 (3 planes for red, 3 planes for green, and 2 planes for blue). This colormap would have red_max = 7, green_max = 7, and blue_max = 3. An alternate allocation 2 November, 1990



XAllocStandardColormap(3X) XAllocStandardColormap(3X)
that uses only 216 colors is red_max = 5, green_max = 5, and blue_max = 5. The red_mult, green_mult, and blue_mult members give the scale factors used to compose a full pixel value. (See the discussion of the base_pixel members for further informa- tion.) For a 3/3/2 allocation, red_mult might be 32, green_mult might be 4, and blue_mult might be 1. For a 6- colors-each allocation, red_mult might be 36, green_mult might be 6, and blue_mult might be 1. The base_pixel member gives the base pixel value used to compose a full pixel value. Usually, the base_pixel is ob- tained from a call to the XAllocColorPlanes function. Given integer red, green, and blue coefficients in their appropri- ate ranges, one then can compute a corresponding pixel value by using the following expression:
r * red_mult + g * green_mult + b * blue_mult + base_pixel
For GrayScale colormaps, only the colormap, red_max,
red_mult, and base_pixel members are defined. The other
members are ignored.
The visualid member gives the ID number of the visual from
which the colormap was created. The killid member gives a
resource ID that indicates whether the cells held by this
standard colormap are to be released by freeing the colormap
ID or by calling the XKillClient function on the indicated
resource. (Note that this method is necessary for allocat-
ing out of an existing colormap).
To compute a GrayScale pixel value, use the following ex-
pression:
gray * red_mult + base_pixel
The properties containing the XStandardColormap information
have the type RGB_COLOR_MAP.
ERRORS
BadAlloc
The server failed to allocate the requested resource
or server memory.
BadAtom A value for an Atom argument does not name a defined
Atom.
BadWindow
A value for a Window argument does not name a de-
fined Window.
The XGetRGBColormaps function can generate BadAtom and
BadWindow errors.
The XSetRGBColormaps function can generate BadAlloc, BadA-
tom, and BadWindow errors.
SEE ALSO
XAllocColor(3X), XCreateColormap(3X), XFree(3X),
XSetCloseDownMode(3X)
Xlib - C Language Interface
November, 1990 3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026