12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFTmake use of as many ofthe available colors as possible. On a typical X display, many applicationsare active at once. Most workstations have only one hardware look-up table for colors, soonly one application colormap can be installed at a given time. The application using theinstalled colormap is displayed correctly, and the other applications go technicolor and are displayedwith false colors.As another example, consider a user who is running an image processing program to displayearth-resources data. The image processing program needs a colormap set up with 8 reds, 8greens, and 4 blues, for a total of 256 colors. Because some colors are already in use in thedefault colormap, the image processing program allocates and installs a new colormap.The user decides to alter some of the colors in the image by invoking a color palette program tomix and choose colors. The color palette program also needs a colormap with eight reds, eightgreens, and four blues, so just like the image processing program, it must allocate and install anew colormap.Because only one colormap can be installed at a time, the color palette may be displayed incorrectlywhenever the image processing program is active. Conversely, whenever the palette programis active, the image may be displayed incorrectly. The user can never match or comparecolors in the palette and image. Contention for colormap resources can be reduced if applicationswith similar color needs share colormaps.The image processing program and the color palette program could share the same colormap ifthere existed a convention that described how the colormap was set up. Whenever either programwas active, both would be displayed correctly.The standard colormap properties define a set of commonly used colormaps. Applications thatshare these colormaps and conventions display true colors more often and provide a better interfaceto the user.Standard colormaps allow applications to share commonly used color resources. This allowsmany applications to be displayed in true colors simultaneously, even when each applicationneeds an entirely filled colormap.Several standard colormaps are described in this section. Usually, awindow manager createsthese colormaps. Applications should use the standard colormaps if they already exist.To allocate an XStandardColormap structure, use XAllocStandardColormap.XStandardColormap *XAllocStandardColormap()The XAllocStandardColormap function allocates and returns a pointer to an XStandardColormapstructure. Note that all fields in the XStandardColormap structure are initially set tozero. If insufficient memory is available, XAllocStandardColormap returns NULL. To free thememory allocated to this structure, use XFree.The XStandardColormap structure contains:377

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!