Passa al contenuto principale

Requests: Colormaps

CreateColormap​

mid: COLORMAP
visual: VISUALID
window: WINDOW
alloc: {None, All}
Errors: IDChoice, Window, Value, Match, Alloc

Creates a colormap of the specified visual type for the screen on which the window resides, and associates the identifier mid with it. The visual type must be one supported by the screen, and cannot be of class TrueColor (else a Match error). The initial values of the colormap entries are undefined for classes GrayScale, PseudoColor, and DirectColor; for StaticGray, StaticColor, and TrueColor, the entries will have defined values, but those values are specific to the visual and are not defined by the core protocol. For StaticGray, StaticColor, and TrueColor, alloc must be specified as None (else a Match error). For the other classes, if alloc is None, the colormap initially has no allocated entries, and clients can allocate entries. If alloc is All, then the entire colormap is "allocated" writable, but entries cannot be freed with FreeColors, and no relationships among entries is defined; the client must understand whether the colormap is GrayScale, PseudoColor, or DirectColor to know how to store into entries.

FreeColormap​

cmap: COLORMAP
Errors: Colormap

Deletes the association between the resource id and the colormap. If the colormap is an installed map for a screen, it is uninstalled (see UninstallColormap). If the colormap is defined as the colormap for a window (via CreateWindow or ChangeWindowAttributes), the colormap for the window is changed to None, and a ColormapNotify event is generated.The colors displayed for a window with a colormap of None are not defined by the protocol.

Has no effect on a default colormap for a screen.

CopyColormapAndFree​

mid, src-cmap: COLORMAP
Errors: Colormap, Alloc

Creates a colormap for the same screen as src-cmap, and associates identifier mid with it. Moves all of the client's existing allocations from src-cmap to the new colormap, and frees those entries in src-cmap. Values in other entries in the new colormap are undefined.

InstallColormap​

cmap: COLORMAP
Errors: Colormap

Makes this colormap an installed map for its screen. All windows associated with this colormap immediately display with true colors. As a side-effect, previously installed colormaps may be uninstalled, and other windows may display with false colors. Which colormaps get uninstalled is server dependent, except that it is guaranteed that the M-1 most recently client-installed colormaps will not be uninstalled, where M is the min-installed-maps specified for the screen in the connection setup.

If cmap is not already an installed map, a ColormapNotify event is generated on every window having cmap as an attribute. If a colormap is uninstalled as a result of the install, a ColormapNotify event is generated on every window having that colormap as an attribute.

Initially only the default colormap for a screen is installed.

UninstallColormap​

cmap: COLORMAP
Errors: Colormap

If cmap is an installed map for its screen, one or more colormaps are installed in its place; the choice is server dependent, pexcept that if the screen's default colormap is not installed and can be installed (without forcing other colormaps out), then the default colormap is used.

If cmap is an installed map, a ColormapNotify event is generated on every window having this colormap as an attribute. If a colormap is installed as a result of the uninstall, a ColormapNotify event is generated on every window having that colormap as an attribute.

ListInstalledColormaps​

window: WINDOW

=>

cmaps: LISTofCOLORMAP
Errors: Window

Returns a list of the currently installed colormaps for the screen of the specified window.

AllocColor​

cmap: COLORMAP
red, green, blue: CARD16

=>

pixel: CARD32
red, green, blue: CARD16
Errors: Colormap, Alloc

Allocates a read-only colormap entry corresponding to the closest RGB values provided by the hardware. Returns the pixel and the RGB values actually used.

AllocNamedColor​

cmap: COLORMAP
name: STRING8

=>

pixel: CARD32
exact-red, exact-green, exact-blue: CARD16
screen-red, screen-green, screen-blue: CARD16
Errors: Colormap, Name, Alloc

Looks up the named color with respect to the screen associated with the colormap, then does an AllocColor on cmap. The name should use the ASCII encoding, and upper/lower case does not matter. The exact RGB values specify the "true" values for the color, and the screen values specify the values actually used in the colormap.

AllocColorCells​

cmap: COLORMAP
colors, planes: CARD16
contiguous: BOOL

=>

pixels, masks: LISTofCARD32
Errors: Colormap, Value, Alloc

The number of colors must be positive, the number of planes non-negative. If C colors and P planes are requested, then C pixels and P masks are returned. No mask will have any bits in common with any other mask, or with any of the pixels. By ORing together masks and pixels, C*(2^P) distinct pixels can be produced; all of these are allocated writable by the request. For GrayScale or PseudoColor, each mask will have exactly one bit, and for DirectColor each will have exactly three bits. If contiguous is True, then if all masks are ORed together, a single contiguous set of bits will be formed for GrayScale or PseudoColor, and three contiguous sets of bits (one within each pixel subfield) for DirectColor. The RGB values of the allocated entries are undefined.

AllocColorPlanes​

cmap: COLORMAP
colors, reds, greens, blues: CARD16
contiguous: BOOL

=>

pixels: LISTofCARD32
red-mask, green-mask, blue-mask: CARD32

Errors; Colormap, Value, Alloc The number of colors must be positive, the reds, greens, and blues non-negative. If C colors, R reds, G greens, and B blues are requested, then C pixels are returned, and the masks have R, G, and B bits set respectively. If contiguous is True, then each mask will have a contiguous set of bits. No mask will have any bits in common with any other mask, or with any of the pixels. For DirectColor, each mask will lie within the corresponding pixel subfield. By ORing together subsets of masks with pixels, C*(2^(R+G+B)) distinct pixels can be produced; all of these are allocated by the request. The initial RGB values of the allocated entries are undefined. In the colormap there are only C*(2^R) independent red entries, C*(2^G) independent green entries, and C*(2^B) independent blue entries. This is true even for PseudoColor. When the colormap entry for a pixel value is changed using StoreColors or StoreNamedColor, the pixel is decomposed according to the masks and the corresponding independent entries are updated.

FreeColors​

cmap: COLORMAP
pixels: LISTofCARD32
plane-mask: CARD32
Errors: Colormap, Access, Value

The plane-mask should not have any bits in common with any of the pixels. The set of all pixels is produced by ORing together subsets of plane-mask with the pixels. The request frees all of these pixels. Note that freeing an individual pixel obtained from AllocColorPlanes may not actually allow it to be reused until all of its "related" pixels are also freed.

All specified pixels that are allocated by the client in cmap are freed, even if one or more pixels produce an error. A Value error is generated if a specified pixel is not a valid index into cmap, and an Access error is generated if a specified pixel is not allocated by the client (i.e., is unallocated or is only allocated by another client). If more than one pixel is in error, which one is reported is arbitrary.

StoreColors​

cmap: COLORMAP
items: LISTofCOLORITEM

where

COLORITEM: [pixel: CARD32
do-red, do-green, do-blue: BOOL
red, green, blue: CARD16]
Errors: Colormap, Access, Value

Changes the colormap entries of the specified pixels. The do-red, do-green, and do-blue fields indicate which components should actually be changed. If the colormap is an installed map for its screen, the changes are visible immediately.

All specified pixels that are allocated writable in cmap (by any client) are changed, even if one or more pixels produce an error. A Value error is generated if a specified pixel is not a valid index into cmap, and an Access error is generated if a specified pixel is unallocated or is allocated read-only. If more than one pixel is in error, which one is reported is arbitrary.

StoreNamedColor​

cmap: COLORMAP
pixel: CARD32
name: STRING8
do-red, do-green, do-blue: BOOL
Errors: Colormap, Name, Access, Value

Looks up the named color with respect to the screen associated with cmap, then does a StoreColors in cmap. The name should use the ASCII encoding, and upper/lower case does not matter.

QueryColors​

cmap: COLORMAP
pixels: LISTofCARD32

=>

colors: LISTofRGB

where

RGB: [red, green, blue: CARD16]
Errors: Colormap, Value

Returns the color values stored in cmap for the specified pixels. The values returned for an unallocated entry are undefined. A Value error is generated if a pixel is not a valid index into cmap. If more than one pixel is in error, which one is reported is arbitrary.

LookupColor​

cmap: COLORMAP
name: STRING8

=>

exact-red, exact-green, exact-blue: CARD16
screen-red, screen-green, screen-blue: CARD16
Errors: Colormap, Name

Looks up the string name of a color with respect to the screen associated with cmap, and returns both the exact the color values and the closest values provided by the hardware. The name should use the ASCII encoding, and upper/lower case does not matter.