Name
XmHTMLAllocColor - a convenience function for allocating a color
Synopsis
Pixel XmHTMLAllocColor(Widget w, String color, Pixel def_pixel)
Description
XmHTMLAllocColor allocates the requested color using the colormap of
the given widget. When the color can not be matched exactly, a least
squares algorithm is used to search for the closest color in the
colormap.
- w
- Specifies the parent Widget ID. Colors are allocated using the
colormap of this widget, which does not have to be a XmHTML widget;
- color
- Specifies the color to be allocated. This can be either a symbolic
name (e.i., SlateBlue) or an RGB triplet of the form #RRGGBB.
Case is ignored;
- def_pixel
- the pixel to be returned if the requested color could not be
allocated;
Return Value
A pixel value representing the allocated color.
Examples
Allocate the (symbolic) color red and return the default black pixel if
allocation fails.
Pixel pix;
Widget w;
pix = XmHTMLAllocColor(w, "Red", BlackPixelOfScreen(XtScreen(w)));
Allocate a RGB color and return the default white pixel if allocation
fails.
Pixel pix;
Widget w;
pix = XmHTMLAllocColor(w, "#3e0fc1", WhitePixelOfScreen(XtScreen(w)));
See Also
XmHTMLFreeColor(3X), XParseColor(3X), XAllocColor(3X)
XmHTML, October 7, 1997