Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tk_getvisual(3) [mojave man page]

Tk_GetVisual(3) 					       Tk Library Procedures						   Tk_GetVisual(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tk_GetVisual - translate from string to visual SYNOPSIS
#include <tk.h> Visual * Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr) ARGUMENTS
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. _________________________________________________________________ DESCRIPTION
Tk_GetVisual takes a string description of a visual and finds a suitable X Visual for use in tkwin, if there is one. It returns a pointer to the X Visual structure for the visual and stores the number of bits per pixel for it at *depthPtr. If string is unrecognizable or if no suitable visual could be found, then NULL is returned and Tk_GetVisual leaves an error message in interp->result. If colormap is non-NULL then Tk_GetVisual also locates an appropriate colormap for use with the result visual and stores its X identifier at *colormapPtr. 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. default Use the default visual for tkwin's screen. pathName Use the visual for the window given by pathName. pathName must be the name of a window on the same screen as tkwin. number 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) 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); (b) if no depth is specified, then the deepest available visual is chosen; (c) pseudocolor is better than truecolor or directcolor, which are better than staticcolor, which is better than stat- icgray or grayscale; (d) the default visual for the screen is better than any other visual. CREDITS
The idea for Tk_GetVisual, and the first implementation, came from Paul Mackerras. KEYWORDS
colormap, screen, visual Tk 4.0 Tk_GetVisual(3)

Check Out this Related Man Page

Tk_GetColormap(3)					       Tk Library Procedures						 Tk_GetColormap(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap - allocate and free colormaps SYNOPSIS
#include <tk.h> Colormap Tk_GetColormap(interp, tkwin, string) Tk_PreserveColormap(display, colormap) Tk_FreeColormap(display, colormap) ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for error reporting. Tk_Window tkwin (in) Token for window in which colormap will be used. const char *string (in) Selects a colormap: either new or the name of a window with the same screen and visual as tkwin. Display *display (in) Display for which colormap was allocated. Colormap colormap (in) Colormap to free or preserve; must have been returned by a previous call to Tk_GetColormap or Tk_GetVi- sual. _________________________________________________________________ DESCRIPTION
These procedures are used to manage colormaps. Tk_GetColormap returns a colormap suitable for use in tkwin. If its string argument is new then a new colormap is created; otherwise string must be the name of another window with the same screen and visual as tkwin, and the col- ormap from that window is returned. If string does not make sense, or if it refers to a window on a different screen from tkwin or with a different visual than tkwin, then Tk_GetColormap returns None and leaves an error message in interp's result. Tk_PreserveColormap increases the internal reference count for a colormap previously returned by Tk_GetColormap, which allows the colormap to be stored in several locations without knowing which order they will be released. Tk_FreeColormap should be called when a colormap returned by Tk_GetColormap is no longer needed. Tk maintains a reference count for each colormap returned by Tk_GetColormap, so there should eventually be one call to Tk_FreeColormap for each call to Tk_GetColormap and each call to Tk_PreserveColormap. When a colormap's reference count becomes zero, Tk releases the X colormap. Tk_GetVisual and Tk_GetColormap work together, in that a new colormap created by Tk_GetVisual may later be returned by Tk_GetColormap. The reference counting mechanism for colormaps includes both procedures, so callers of Tk_GetVisual must also call Tk_FreeColormap to release the colormap. If Tk_GetColormap is called with a string value of new then the resulting colormap will never be returned by Tk_GetVisual; however, it can be used in other windows by calling Tk_GetColormap with the original window's name as string. KEYWORDS
colormap, visual Tk 4.0 Tk_GetColormap(3)
Man Page