Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XLookupColor(3X11) — BSD/386 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XAllocColor(3X11)

XCreateColormap(3X11)

ors(3X11)



XQueryColor(3X11)         XLIB FUNCTIONS        XQueryColor(3X11)


NAME
       XQueryColor, XQueryColors, XLookupColor, XParseColor -
       obtain color values

SYNTAX
       XQueryColor(display, colormap, definout)
             Display *display;
             Colormap colormap;
             XColor *definout;

       XQueryColors(display, colormap, defsinout, ncolors)
             Display *display;
             Colormap colormap;
             XColor defsinout[];
             int ncolors;

       Status XLookupColor(display, colormap, colorname,
       exactdefreturn, screendefreturn)
             Display *display;
             Colormap colormap;
             char *colorname;
             XColor *exactdefreturn, *screendefreturn;

       Status XParseColor(display, colormap, spec,
       exactdefreturn)
               Display *display;
               Colormap colormap;
               char *spec;
               XColor *exactdefreturn;

ARGUMENTS
       colormap  Specifies the colormap.

       colorname
                 Specifies the color name string (for example,
                 red) whose color definition structure you want
                 returned.

       definout
                 Specifies and returns the RGB values for the
                 pixel specified in the structure.

       defsinout
                 Specifies and returns an array of color defini-
                 tion structures for the pixel specified in the
                 structure.

       display   Specifies the connection to the X server.

       exactdefreturn
                 Returns the exact RGB values.

       ncolors   Specifies the number of XColor structures in the
                 color definition array.



X Version 11                Release 5                           1




XQueryColor(3X11)         XLIB FUNCTIONS        XQueryColor(3X11)


       screendefreturn
                 Returns the closest RGB values provided by the
                 hardware.

       spec      Specifies the color name string; case is
                 ignored.

       exactdefreturn
                 Returns the exact color value for later use and
                 sets the DoRed, DoGreen, and DoBlue flags.

DESCRIPTION
       The XQueryColor function returns the current RGB value for
       the pixel in the XColor structure and sets the DoRed,
       DoGreen, and DoBlue flags.  The XQueryColors function
       returns the RGB value for each pixel in each XColor struc-
       ture, and sets the DoRed, DoGreen, and DoBlue flags in
       each structure.


       XQueryColor and XQueryColors can generate BadColor and
       BadValue errors.

       The XLookupColor function looks up the string name of a
       color with respect to the screen associated with the spec-
       ified colormap.  It returns both the exact color values
       and the closest values provided by the screen with respect
       to the visual type of the specified colormap.  If the
       color name is not in the Host Portable Character Encoding
       the result is implementation dependent.  Use of uppercase
       or lowercase does not matter.  XLookupColor returns
       nonzero if the name is resolved, otherwise it returns
       zero.

       The XParseColor function looks up the string name of a
       color with respect to the screen associated with the spec-
       ified colormap.  It returns the exact color value.  If the
       color name is not in the Host Portable Character Encoding
       the result is implementation dependent.  Use of uppercase
       or lowercase does not matter.  XParseColor returns nonzero
       if the name is resolved, otherwise it returns zero.

       XLookupColor and XParseColor can generate BadColor error.

COLOR NAMES
       An RGB Device specification is identified by the prefix
       "rgb:" and conforms to the following syntax:

       rgb:<red>/<green>/<blue>

           <red>, <green>, <blue> := h | hh | hhh | hhhh
           h := single hexadecimal digits (case insignificant)

       Note that h indicates the value scaled in 4 bits, hh the



X Version 11                Release 5                           2




XQueryColor(3X11)         XLIB FUNCTIONS        XQueryColor(3X11)


       value scaled in 8 bits, hhh the value scaled in 12 bits,
       and hhhh the value scaled in 16 bits, respectively.

       For backward compatibility, an older syntax for RGB Device
       is supported, but its continued use is not encouraged.
       The syntax is an initial sharp sign character followed by
       a numeric specification, in one of the following formats:

       #RGB                (4 bits each)
       #RRGGBB             (8 bits each)
       #RRRGGGBBB          (12 bits each)
       #RRRRGGGGBBBB       (16 bits each)

       The R, G, and B represent single hexadecimal digits.  When
       fewer than 16 bits each are specified, they represent the
       most-significant bits of the value (unlike the "rgb:" syn-
       tax, in which values are scaled).  For example, #3a7 is
       the same as #3000a0007000.

       An RGB intensity specification is identified by the prefix
       "rgbi:" and conforms to the following syntax:

       rgbi:<red>/<green>/<blue>

       Note that red, green, and blue are floating point values
       between 0.0 and 1.0, inclusive.  The input format for
       these values is an optional sign, a string of numbers pos-
       sibly containing a decimal point, and an optional exponent
       field containing an E or e followed by a possibly signed
       integer string.

       The standard device-independent string specifications have
       the following syntax:

       CIEXYZ:<X>/<Y>/<Z>
       CIEuvY:<u>/<v>/<Y>
       CIExyY:<x>/<y>/<Y>
       CIELab:<L>/<a>/<b>
       CIELuv:<L>/<u>/<v>
       TekHVC:<H>/<V>/<C>

       All of the values (C, H, V, X, Y, Z, a, b, u, v, y, x) are
       floating point values.  The syntax for these values is an
       optional '+' or '-' sign, a string of digits possibly con-
       taining a decimal point, and an optional exponent field
       consisting of an 'E' or 'e' followed by an optional '+' or
       '-' followed by a string of digits.

DIAGNOSTICS
       BadColor  A value for a Colormap argument does not name a
                 defined Colormap.

       BadValue  Some numeric value falls outside the range of
                 values accepted by the request.  Unless a



X Version 11                Release 5                           3




XQueryColor(3X11)         XLIB FUNCTIONS        XQueryColor(3X11)


                 specific range is specified for an argument, the
                 full range defined by the argument's type is
                 accepted.  Any argument defined as a set of
                 alternatives can generate this error.

SEE ALSO
       XAllocColor(3X11), XCreateColormap(3X11), XStoreCol-
       ors(3X11)
       Xlib - C Language X Interface
















































X Version 11                Release 5                           4


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