7.11 Miscellaneous Color-handling Functions
The following miscellaneous functions provide additional ways to use the color database, to find out the RGB values in a colormap cell, and to free cells that are no longer needed:
XLookupColor()Looks up a string color name in the color database and returns separate color structures containing the exact RGB values specified in the database for that name and the closest RGB values available on the hardware. This function does not look at any cells in the colormap, even though it has a
colormapargument! This argument specifies which screen the color should be looked up on, which is relevant only if each screen has a different color characterization or color database. The difference betweenXLookupColor()andXParseColor()is thatXParseColor()accepts the hexadecimal color specification (whichXLookupColor()does not), whileXLookupColor()returns the closest colors available on the hardware (whichXParseColor()does not).XLookupColor()might be useful for making sure that user-specified colors are contrasting. There is also an Xcms version,XcmsLookupColor(), that is analogous toXLookupColor()except with different arguments and the Xcms version returns a device-independent color specification.XQueryColor()Fills an
XColorstructure with the RGB values corresponding to the colormap cell indicated by a pixel value. Also sets theflagsmember of the structure to (DoRed | DoGreen | DoBlue). The Xcms version,XcmsQueryColor(), translates the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access