XcmsAllocNamedColor

Syntax

Status XcmsAllocNamedColor(display, colormap, color_string, color_screen_return, color_exact_return,
                            result_format)
      Display *display;
      Colormap colormap;
      char *color_string;
      XcmsColor *color_screen_return;
      XcmsColor *color_exact_return;
      XcmsColorFormat result_format;

Arguments

display Specifies the connection to the X server.
colormap Specifies the colormap. .ds St \ whose color definition structure is to be returned
color_string Specifies the color string\*(St.
color_screen_return Returns the pixel value of the color cell and color specification that actually is stored for that cell.
color_exact_return Returns the color specification parsed from the color string or parsed from the corresponding string found in a color name database.
result_format Specifies the color format for the returned color specifications (color_screen_return and color_exact_return arguments). If the format is XcmsUndefinedFormat and the color string contains a numerical color specification, the specification is returned in the format used in that numerical color specification. If the format is XcmsUndefinedFormat and the color string contains a color name, the specification is returned in the format used to store the color in the database.

Description

The XcmsAllocNamedColor() function is similar to XAllocNamedColor() except the color returned can be in any format specified. This function ultimately calls XAllocColor() to allocate a read-only color cell with the color specified by a color string. The color string is parsed into an XcmsColor structure (see XcmsLookupColor()), converted to an RGB value, and finally passed to XAllocColor(). If the color name is not in the Host Portable Character Encoding, the result is implementation dependent. Use of uppercase or lowercase does not matter.

This function returns both the color specification as a result of parsing (exact specification) and the actual color specification stored (screen specification). This screen specification is the result of converting the RGB value returned by XAllocColor() into the format specified in result_format. If there is no interest in a returned color specification, unnecessary computation can be bypassed if result_format is set to XcmsRGBFormat. If color_screen_return and color_exact_return point to the same structure, the pixel field will be set correctly but the color values are undefined.

XcmsAllocNamedColor() can generate a BadColor error.

Diagnostics

BadColor A value for a Colormap argument does not name a defined Colormap.

See also

XcmsAllocColor(), XcmsQueryColor(), XcmsStoreColor(), "Allocating and Freeing Color Cells".
Christophe Tronche, [email protected]