Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XSeStandC(3X11) — Amiga System V Release 4 Version 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XSetStandardColormap(3X11)



XSetStandardColormap(3X11)             XSetStandardColormap(3X11)



NAME
     XSetStandardColormap, XGetStandardColormap - set or get
     standard colormaps

SYNTAX
     XSetStandardColormap(display, w, colormap, property)
           Display *display;
           Window w;
           XStandardColormap *colormap;
           Atom property;     /* RGB_BEST_MAP, etc. */

     Status XGetStandardColormap(display, w, colormap_return,
     property)
           Display *display;
           Window w;
           XStandardColormap *colormap_return;
           Atom property;     /* RGB_BEST_MAP, etc. */

ARGUMENTS
     colormap  Specifies the colormap.

     colormap_return
               Returns the colormap associated with the specified
               atom.

     display   Specifies the connection to the XWIN server.

     property  Specifies the property name.

     w         Specifies the window.

DESCRIPTION
     The XSetStandardColormap function usually is only used by
     window managers. To create a standard colormap, follow this
     procedure:

     1.   Open a new connection to the same server.

     2.   Grab the server.

     3.   See if the property is on the property list of the root
          window for the screen.

     4.   If the desired property is not present:

          ⊕    Create a colormap (not required for
               RGB_DEFAULT_MAP)

          ⊕    Determine the color capabilities of the display.

          ⊕    Call XAllocColorPlanes or XAllocColorCells to
               allocate cells in the colormap.



XWIN 3.0               Last change: 9/1/88                 .ie t





XSetStandardColormap(3X11)             XSetStandardColormap(3X11)



          ⊕    Call XStoreColors to store appropriate color
               values in the colormap.

          ⊕    Fill in the descriptive members in the XStandard-
               Colormap structure.

          ⊕    Attach the property to the root window.

          ⊕    Use XSetCloseDownMode to make the resource per-
               manent.

     5.   Ungrab the server.

     XSetStandardColormap can generate BadAlloc, BadAtom, and
     BadWindow errors.

     The XGetStandardColormap function returns the colormap
     definition associated with the atom supplied as the property
     argument.  For example, to fetch the standard GrayScale
     colormap for a display, you use XGetStandardColormap with
     the following syntax:

     XGetStandardColormap(dpy, DefaultRootWindow(dpy), &cmap, XA_RGB_GRAY_MAP);

     Once you have fetched a standard colormap, you can use it to
     convert RGB values into pixel values.  For example, given an
     XStandardColormap structure and floating-point RGB coeffi-
     cients in the range 0.0 to 1.0, you can compose pixel values
     with the following C expression:

     pixel = base_pixel
          + ((unsigned long) (0.5 + r * red_max)) * red_mult
          + ((unsigned long) (0.5 + g * green_max)) * green_mult
          + ((unsigned long) (0.5 + b * blue_max)) * blue_mult;

     The use of addition rather than logical OR for composing
     pixel values permits allocations where the RGB value is not
     aligned to bit boundaries.

     XGetStandardColormap can generate BadAtom and BadWindow
     errors.

DIAGNOSTICS
     BadAlloc  The server failed to allocate the requested
               resource or server memory.

     BadAtom   A value for an Atom argument does not name a
               defined Atom.

     BadWindow A value for a Window argument does not name a
               defined Window.




XWIN 3.0               Last change: 9/1/88                 .ie t





XSetStandardColormap(3X11)             XSetStandardColormap(3X11)



SEE ALSO
     Xlib - C Language X Interface





















































XWIN 3.0               Last change: 9/1/88                 .ie t





XSetStandardColormap(3X11)             XSetStandardColormap(3X11)























































XWIN 3.0               Last change: 9/1/88                 .ie t






Typewritten Software • bear@typewritten.org • Edmonds, WA 98026