Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xallocnamedcolor(3) [hpux man page]

XAllocNamedColor()														XAllocNamedColor()

Name
  XAllocNamedColor - allocate a read-only colorcell from color name.

Synopsis
  Status XAllocNamedColor(display, colormap, color_name, screen_def_return, exact_def_return)
	Display *display;
	Colormap colormap;
	char *color_name;
	XColor *screen_def_return;
	XColor *exact_def_return;

Arguments
  display   Specifies a connection to an X server; returned from XOpenDisplay().

  colormap  Specifies the ID of the colormap in which the colorcell will be allocated.

  color_name
	    Specifies the color name string (for example, "red") you want.  Uppercase or lowercase does not matter.  If the color name is not
	    in the Host Portable Character Encoding, the result is implementation-dependent.

  screen_def_return
	    Returns the pixel value and RGB values actually used in the colormap.  This is the closest color supported by the hardware.

  exact_def_return
	    Returns the exact RGB values from the database corresponding to the color_name supplied.

Returns
  Zero on failure, non-zero on success.

Description
  XAllocNamedColor() determines the RGB values for the specified color_name from the color database, and then allocates a read-only colorcell
  with the closest color available, as described under XAllocColor().

  Like	XAllocColor,  XAllocNamedColor() acts differently on static and dynamic visuals.  On PseudoColor, DirectColor, and GrayScale visuals,
  XAllocNamedColor() fails if there are no unallocated colorcells and no allocated read-only colorcell exactly matches the  database  defini-
  tion	of the requested color.  On StaticColor, TrueColor, and StaticGray visuals, XAllocNamedColor() returns the closest RGB values (to the
  database definition of the requested color) available in the colormap.  Both the database definition of the color, and the  color  actually
  allocated are returned.

  XAllocNamedColor()  returns a Status of zero if color_name was not found in the database or if the color could not be allocated.  The func-
  tion returns non-zero when it succeeds.

  For more information, see Volume One, Chapter 7, Color.

Errors
  BadColor  colormap is invalid.

Structures
     typedef struct {
	 unsigned long pixel;
	 unsigned short red, green, blue;
	 char flags;	/* DoRed, DoGreen, DoBlue */
	 char pad;
     } XColor;

See Also
  XBlackPixel(), XWhitePixel(), XAllocColor(), XAllocColorCells(), XAllocColorPlanes(), XFreeColors(), XLookupColor(), XParseColor(), XQuery-
  Color(), XQueryColors(), XStoreColor(), XStoreColors(), XStoreNamedColor().

Xlib - Color Cells														XAllocNamedColor()

Check Out this Related Man Page

XQueryColors()															    XQueryColors()

Name
  XQueryColors - obtain RGB values for an array of colorcells.

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

Arguments
  display   Specifies a connection to an X server; returned from XOpenDisplay().

  colormap  Specifies the ID of the colormap from which RGB values will be retrieved.

  defs_in_out
	    Specifies  an  array  of XColor structures.  In each one, pixel is set to indicate which colorcell in the colormap to return, and
	    the RGB values in that colorcell are returned in red, green, and blue.

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

Description
  XQueryColors() is similar to XQueryColor(), but it returns an array of RGB values.  It returns the RGB values in colormap colormap for each
  colorcell corresponding to the pixel value specified in the pixel member of each XColor structure in the colorcell_def array.  The RGB val-
  ues are returned in the red, green, and blue members of that same structure, and sets the flags member in each XColor structure  to  (DoRed
  DoGreen   DoBlue).

  For more information, see Volume One, Chapter 7, Color.

Structures
     typedef struct {
	 unsigned long pixel;
	 unsigned short red, green, blue;
	 char flags;	    /* DoRed, DoGreen, DoBlue */
	 char pad;
     } XColor;

Errors
  BadColor  Invalid colormap.

  BadValue  Pixel not valid index into colormap.

  Note:  if more than one pixel value is in error, the one reported is arbitrary.

See Also
  XBlackPixel(),  XWhitePixel(),  XAllocColor(),  XAllocColorCells(), XAllocColorPlanes(), XAllocNamedColor(), XFreeColors(), XLookupColor(),
  XParseColor(), XQueryColor(), XStoreColor(), XStoreColors(), XStoreNamedColor().

Xlib - Color Cells														    XQueryColors()
Man Page