Chapter 7. Color
This chapter describes how to use color in your programs. Color handling in X can be more complex than in other graphics systems because of the need for portability to many different types of displays. Certain advanced topics in color handling are still poorly defined in the X standard. This chapter starts with the basics, which everyone working with color should read, and gradually moves to more advanced topics, including R5 device-independent color. Pick and choose from the later sections as appropriate.
A typical X application allows the user to specify colors for the background and border of each of its windows, colors for the cursor, and foreground and background colors to be set in GCs for drawing text and graphics. More complex applications (such as Computer Aided Design (CAD) applications) might use color to distinguish physical or logical layers. Still more complex applications, such as in imaging, might use fine gradations of color to represent real-world data. Yet in discussing the background and border window attributes and how to set the foreground and background members of the GC, we have spoken only of pixel values.
How are these pixel values translated to colors? And how must an X client manage color if it is to run successfully on the wide variety of screen hardware available in the X environment?
Because X must support a wide variety of systems with differing screen hardware, the Xlib color-handling mechanisms are fairly complex. Even programmers ...
Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.