Tcl/Tk Documentation > TkLib > GetVisual
- Tk_GetVisual - translate from string to visual
Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
- Tcl_Interp *interp (in)
- Interpreter to use for error reporting.
- Tk_Window tkwin (in)
- Token for window in which the visual will be used.
- const char *string (in)
- String that identifies the desired visual. See below for valid formats.
- int *depthPtr (out)
- Depth of returned visual gets stored here.
- Colormap *colormapPtr (out)
- If non-NULL then a suitable colormap for visual is found and its identifier is stored here.
The string argument specifies the desired visual in one of the following ways:
- class depth
- The string consists of a class name followed by an integer depth, with any amount of white space (including none) in between. class selects what sort of visual is desired and must be one of directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, or truecolor, or a unique abbreviation. depth specifies how many bits per pixel are needed for the visual. If possible, Tk_GetVisual will return a visual with this depth; if there is no visual of the desired depth then Tk_GetVisual looks first for a visual with greater depth, then one with less depth.
- Use the default visual for tkwin's screen.
- Use the visual for the window given by pathName. pathName must be the name of a window on the same screen as tkwin.
- Use the visual whose X identifier is number.
- best ?depth?
- Choose the “best possible” visual, using the
following rules, in decreasing order of priority:
- a visual that has exactly the desired depth is best, followed by a visual with greater depth than requested (but as little extra as possible), followed by a visual with less depth than requested (but as great a depth as possible);
- if no depth is specified, then the deepest available visual is chosen;
- pseudocolor is better than truecolor or directcolor, which are better than staticcolor, which is better than staticgray or grayscale;
- the default visual for the screen is better than any other visual.
Copyright © 1995-1997 Roger E. Critchlow Jr. Copyright © 1994 The Regents of the University of California. Copyright © 1994-1996 Sun Microsystems, Inc.