1Tk_GetVisual(3)              Tk Library Procedures             Tk_GetVisual(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_GetVisual - translate from string to visual
9

SYNOPSIS

11       #include <tk.h>
12
13       Visual *
14       Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
15

ARGUMENTS

17       Tcl_Interp *interp (in)               Interpreter   to  use  for  error
18                                             reporting.
19
20       Tk_Window tkwin (in)                  Token for  window  in  which  the
21                                             visual will be used.
22
23       const char *string (in)               String    that   identifies   the
24                                             desired visual.   See  below  for
25                                             valid formats.
26
27       int *depthPtr (out)                   Depth  of  returned  visual  gets
28                                             stored here.
29
30       Colormap *colormapPtr (out)           If non-NULL then a suitable  col‐
31                                             ormap for visual is found and its
32                                             identifier is stored here.
33_________________________________________________________________
34

DESCRIPTION

36       Tk_GetVisual takes a string description of a visual and finds  a  suit‐
37       able  X Visual for use in tkwin, if there is one.  It returns a pointer
38       to the X Visual structure for the visual and stores the number of  bits
39       per  pixel  for  it at *depthPtr.  If string is unrecognizable or if no
40       suitable visual could be found, then NULL is returned and  Tk_GetVisual
41       leaves  an  error  message  in interp->result.  If colormap is non-NULL
42       then Tk_GetVisual also locates an appropriate colormap for use with the
43       result visual and stores its X identifier at *colormapPtr.
44
45       The  string argument specifies the desired visual in one of the follow‐
46       ing ways:
47
48       class depth    The string consists of a class name followed by an inte‐
49                      ger  depth,  with  any  amount of white space (including
50                      none) in between.  class selects what sort of visual  is
51                      desired  and  must  be  one  of  directcolor, grayscale,
52                      greyscale, pseudocolor, staticcolor, staticgray, static‐
53                      grey,  or  truecolor,  or  a unique abbreviation.  depth
54                      specifies how many bits per pixel  are  needed  for  the
55                      visual.   If possible, Tk_GetVisual will return a visual
56                      with this depth; if there is no visual  of  the  desired
57                      depth  then  Tk_GetVisual  looks first for a visual with
58                      greater depth, then one with less depth.
59
60       default        Use the default visual for tkwin's screen.
61
62       pathName       Use the visual for the window given by pathName.   path‐
63                      Name  must be the name of a window on the same screen as
64                      tkwin.
65
66       number         Use the visual whose X identifier is number.
67
68       best ?depth?   Choose the “best possible” visual, using  the  following
69                      rules, in decreasing order of priority:
70
71                      (a)    a  visual  that  has exactly the desired depth is
72                             best, followed by a  visual  with  greater  depth
73                             than requested (but as little extra as possible),
74                             followed  by  a  visual  with  less  depth   than
75                             requested (but as great a depth as possible);
76
77                      (b)    if no depth is specified, then the deepest avail‐
78                             able visual is chosen;
79
80                      (c)    pseudocolor is better than truecolor  or  direct‐
81                             color,  which  are better than staticcolor, which
82                             is better than staticgray or grayscale;
83
84                      (d)    the default visual for the screen is better  than
85                             any other visual.
86

CREDITS

88       The idea for Tk_GetVisual, and the first implementation, came from Paul
89       Mackerras.
90

KEYWORDS

92       colormap, screen, visual
93
94
95
96Tk                                    4.0                      Tk_GetVisual(3)
Impressum