Skip to Main Content
Volume 7A: XView Programming Manual
book

Volume 7A: XView Programming Manual

by Dan Heller
October 1994
Intermediate to advanced content levelIntermediate to advanced
770 pages
22h 58m
English
O'Reilly Media, Inc.
Content preview from Volume 7A: XView Programming Manual
21
Color
The X Window System has various ways of allocating, specifying, and using colors. While
all of these methods are available to applications without XView intervening, XView pro-
vides its own model for color specification that may be used as an alternative. It does not
provide anything more than what is already available, but it may provide a simpler interface
to request and specify colors. This model is especially useful when specifying colors for
XView objects, such as panel buttons and scrollbars.
This chapter does not directly discuss how to use colormaps and related Xlib color-specific
functions. For a discussion of them, see Volume One, Xlib Programming Manual, Chapter 7,
Color. This chapter discusses only the XView color model.
Obviously, the user cannot view colors in an application without having a color display. But
you cannot tell at the time your application is written whether the user’s display is going to
be able to support color. You can use the DisplayDepth() macro to determine whether
the user’s display can handle color:
Display *dpy = (Display *)xv_get(frame, XV_DISPLAY);
extern use_color;
if (DefaultDepth(dpy, DefaultScreen(dpy)) < 2)
use_color = False;
21.1 XView Color Model
XView applications deal with color by using colormap segments. Use the CMS package to
create a colormap segment. Figure 21-1 shows the class hierarchy for the CMS package.
As a simple introduction,
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.
Start your free trial

You might also like

Volume 6A: Motif Programming Manual

Volume 6A: Motif Programming Manual

David Brennan, Dan Heller, Paula Ferguson
Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Java™ Media APIs: Cross-Platform Imaging, Media, and Visualization

Alejandro Terrazas, John Ostuni, Michael Barlow

Publisher Resources

ISBN: 9780937175873