MAN page from RedHat Other XITE-3.3-3.i386.rpm
COLORSMENUINIT
Section: C Library Functions (3)
Updated: 16 Mar 1998
Index
NAME
ColorsMenuInit, OverlaysMenuInit, Color_set, Color_ovl_set,Color_add, Color_ovl_add, Color_read, Color_ovl_read,Color_exit, Color_max, Color_ovl_max, Color_map, Color_map2,ColortabName, OvltabName, Xcolor_deftab, AddColormapCopy,Has_changeable_map - XITE color routines
SYNTAX
#include <
xite/Xcolor.h>
void Color_read( char* file_name );
void Color_ovl_read( char* file_name );
void Color_add( XColor coltab[], char* name,
int len );
void Color_ovl_add( XColor coltab[],
char* name, int len );
void ColorsMenuInit( Display* display,
int screenno, Widget parent,
char* colorfile );
void OverlaysMenuInit( Display *display,
int screenno, Widget parent, char *colorfile );
void Color_exit( void );
int Color_set( ImageWidget wid, int color );
int Color_ovl_set( ImageWidget wid, int color );
int Color_max( void );
int Color_ovl_max( void );
char *ColortabName( int coltab );
char *OvltabName( int coltab );
int *Xcolor_deftab( int n );
Colormap Color_map( int map, int xcolors );
Colormap Color_map2( int map, int xcolors,
Visual* visual );
void AddColormapCopy( Widget w, Visual* visual,
char* entryName );
Boolean Has_changeable_map( Display* dpy,
int screen, Visual* visual );
DESCRIPTION
ColorsMenuInitsets the global variables
dpy_sand
screen_sto
displayand
screennorespectively. Theglobal variable
visual_s(representing the globallypreferred visual) is set by calling
GetImageVisualAndColormap.ColorsMenuInitinitializes a popup menu for changing colorsin an Image or ImageOverlay widget. The instance name of themenu (for resource specifications) is "colorsmenu".
ColorsMenuInitadds an entry labeled "Background" (widgetinstance name "backgroundcol") as the first entry in the popupmenu. This entry will activate the default colormap. If theimage is displayed with a visual different from the defaultvisual of the display, then the "Background" entry isinsensitive (can not be chosen).
If a visual with changeable colormap exists for the display(i.e. PseudoColor or DirectColor) and is registered by theapplication, then a second entry called "Work-map" (widgetinstance name " Work-map") is added to the colortable popupmenu. This entry will activate a grayscale colortable which ismade by the routine Color_add.
Finally, if the application has registered changeablecolormaps, ColorsMenuInitreads colorfilewhich contains alist of colortables, and adds them, using Color_read.Leading "~" and environment variables in colorfilewill beexpanded. If colorfileis not found, try to find it in oneof the directories listed in the environment variableXSHOWPATH.
If colorfileis NULL, use the default filenamexshow_colortabsand search for this in the directorieslisted in the environment variable XSHOWPATH.
OverlaysMenuInitworks like ColorsMenuInitexcept that theinstance name of the popup menu is "overlaysmenu", the firstentry's instance name is "backgroundovl", and the secondentry's label and instance name is " Std-overlay". The popupmenu is used to change the colors of the overlay image in anImageOverlay widget. The " Std-overlay" menu entry refersto a predefined (hard-coded) overlay colortable with 32entries.
Color_addadds the colortable coltabInto the list ofcolortables in the Image and ImageOverlay widget Colors popupmenu. The menu entry label and widget instance name are bothset to name.Actually, two new colortables are produced(PseudoColor and DirectColor). One is based on a full-colorversion (256 colors for 8-bit visuals and 16 million colorsfor 24-bit visuals), the other is based on a reduced-colorversion (128 colors + background and overlay colors for 8-bitvisuals, 2 million colors + background and overlay colors for24-bit visuals). Which one of these two are actually chosen byselecting a menu entry in the Colors menu, depends on whetherthe resource XtNdisplayMethod indicates full-color orreduced-color display.
The full-color version basis is grayscale. It is fullymodified by the colortable coltabInsupplied as an argument.
The reduced-color version basis is the XITE-initial colormapdescribed in GetImageColormap(3).It is modified in thepixel value range [64..191] by the colortable supplied as anargument. The rgb values corresponding to pixel values[0..255] in the full-color version are squeezed into the pixelrange [64..191] in the reduced-color version by using onlyevery second value.
With NULL coltabIn,call the menu entry "Work-map", and makethe corresponding colortable grayscale.
Color_ovl_addworks with colors for the overlay of anImageOverlay widget. One new colortable is produced and addedas the last entry of the OverlayColors popup menu. With NULLcoltabIn,a predefined 32-element overlay colortable called"Std-overlay" is put into entries [0..31]. With coltabInnotNULL, it will be used. It is assumed that the pixel elementsof the color-cells in coltabInare consecutive in the range[0..31].
Color_setstores the colorargument in the image widgetXtNcolortab resource and sets the corresponding colormap forthe image window. The colormap is chosen depending on thevalue of the image widget's displaymethod (reduced-color mapof 128 colors for PSEUDO_COLOR_8A (PseudoColor 8-bit visual),full-color map of 256 colors for PSEUDO_COLOR_8B (PseudoColor8-bit visual), reduced-color map of approximately 2 millioncolors for DIRECT_COLOR_24_A (DirectColor 24-bit visual),full-color map of approximately 16 million colors forDIRECT_COLOR_24_B (DirectColor 24-bit visual)).
Color_ovl_setsets XtNoverlayColorCells (Image widgetresource) colors, taken from the 8-bit PseudoColor or 24-bitDirectColor colormap corresponding to overlay colortableovlcolor,starting with pixel value 0, into the widget'sactive colormap identified by XtNcolortab, starting with pixelvalue 192. The XtNoverlaytab resource is set equal toovlcolorand the previous value of XtNoverlaytab isreturned.
Color_readexpands file_name(interpreting csh ~) andreads a BIFF colortable from file, adds it to the Colors popupmenu for the Image and ImageOverlay widget. It uses the routineColor_add.If the filename starts with the character '+',the routine simply calls Color_ovl_read.file_nameisfirst searched for in the directory given by the environmentvariable XSHOWPATH.
Color_ovl_readbehaves like Color_add,but the colortableis added as the last entry of the OverlayColors popup menu forImageOverlay widgets. It uses the routine Color_ovl_add.
Color_exitis an empty function.
Color_maxreturns (one less than) the number of colors inthe list of colortables available from the Image andImageOverlay widget Colors popup menu. It is the index to thelast colortable added.
Color_ovl_maxreturns (one less than) the number of colorsin the list of overlay colortables available from theImageOverlay widget OverlayColors popup menu. It is the indexto the last colortable added.
Color_map2checks whether the visualhas changeablecolormaps and if so, uses mapas an index into the Image andImageOverlay Colors popup menu to return the 128- or256-element colormap, depending on the value of xcolors(which should be 2, 128 or 256). If xcolorsis zero, use thenumber of colormap entries of visual.If this is 256, use128 (i.e. use "reduced-colors" display as default). Ifvisualdoes not have changeable colormaps or if xcolors(or the number of colormap entries) equals 2, return NULL.
Color_mapbehaves like Color_map2except that the globallypreferred visual is used instead of visual.
Xcolor_deftabis obsolete since XITE version 3.3, but isretained for backwards compatibility. Since version 3.3,setting default values for the resources XtNcolorPtr andXtNoverlayColorPtr is taken care of by the Image widget andImageOverlayWidget respectively.
Xcolor_deftabreturns a pointer to an integer array with 32,128 or 256 consecutive integer elements, depending on theargument n.nequal to 32 returns the table 192,...,223.nequal to 12 returns the table 64,...,191. nequal to256 returns the table 0,...,255. Illegal nreturns NULL.The 32-element table is used as XtNoverlayColorPtr resourcefor ImageOverlay widgets. The 128- and 256-element tablesare used as XtNcolorPtr resources for Image or ImageOverlaywidgets (128 for reduced-color display, 256 for full-colordisplay).
AddColormapCopyadds the full- and reduced-color versions ofthe current colortable (as given by the XtNcolortab Imagewidget resource) to the Colors popup menu, with name given byentryName.
Has_changeable_mapchecks whether visualhas changeablecolormaps. dpyand screenare not used.
ColortabNamereturns the name of entry number coltabinthe "Colors" menu in the image widget.
OvltabNamereturns the name of entry number coltabinthe "OverlayColors" menu in the image widget.
AUTHOR
Otto Milvang and Svein Bøe
DOC
Svein Bøe
ID
$Id: Xcolor.c,v 1.117 1997/08/04 11:14:00 svein Exp $
Index
- NAME
- SYNTAX
- DESCRIPTION
- AUTHOR
- DOC
- ID
This document was created byman2html,using the manual pages.