Debian Codegraph @

pod/pTk/GetVisual.pod

raw
1 # Copyright (c) 1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk_GetVisual - translate from string to visual
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 Visual *
19 B<Tk_GetVisual(>I<interp, tkwin, string, depthPtr, colormapPtr>B<)>
20
21 =head1 ARGUMENTS
22
23 =over 4
24
25 =item Tcl_Interp *interp (in)
26
27 Interpreter to use for error reporting.
28
29 =item Tk_Window tkwin (in)
30
31 Token for window in which the visual will be used.
32
33 =item char *string (in)
34
35 String that identifies the desired visual. See below for
36 valid formats.
37
38 =item int *depthPtr (out)
39
40 Depth of returned visual gets stored here.
41
42 =item Colormap *colormapPtr (out)
43
44 If non-NULL then a suitable colormap for visual is found and its
45 identifier is stored here.
46
47 =back
48
49 =head1 DESCRIPTION
50
51 B<Tk_GetVisual> takes a string description of a visual and
52 finds a suitable X Visual for use in I<tkwin>, if there is one.
53 It returns a pointer to the X Visual structure for the visual
54 and stores the number of bits per pixel for it at I<*depthPtr>.
55 If I<string> is unrecognizable or if no suitable visual could
56 be found, then NULL is returned and B<Tk_GetVisual> leaves
57 an error message in I<interp-E<gt>result>.
58 If I<colormap> is non-NULL then B<Tk_GetVisual>
59 also locates an appropriate colormap for use with the result visual
60 and stores its X identifier at I<*colormapPtr>.
61
62 The I<string> argument specifies the desired visual in one
63 of the following ways:
64
65 =over 4
66
67 =item I<class depth>
68
69 The string consists of a class name followed by an integer depth,
70 with any amount of white space (including none) in between.
71 I<class> selects what sort of visual is desired and must be one of
72 B<directcolor>, B<grayscale>, B<greyscale>, B<pseudocolor>,
73 B<staticcolor>, B<staticgray>, B<staticgrey>, or
74 B<truecolor>, or a unique abbreviation.
75 I<depth> specifies how many bits per pixel are needed for the
76 visual.
77 If possible, B<Tk_GetVisual> will return a visual with this depth;
78 if there is no visual of the desired depth then B<Tk_GetVisual>
79 looks first for a visual with greater depth, then one with less
80 depth.
81
82 =item B<default>
83
84 Use the default visual for I<tkwin>'s screen.
85
86 =item $widget
87
88 Use the visual for the window given by $widget.
89 $widget must be the name of a window on the same screen
90 as I<tkwin>.
91
92 =item I<number>
93
94 Use the visual whose X identifier is I<number>.
95
96 =item B<best> ?I<depth>?
97
98 Choose the ``best possible'' visual, using the following rules, in
99 decreasing order of priority:
100 (a) a visual that has exactly the desired depth is best, followed
101 by a visual with greater depth than requested (but as little extra
102 as possible), followed by a visual with less depth than requested
103 (but as great a depth as possible);
104 (b) if no I<depth> is specified, then the deepest available visual
105 is chosen;
106 (c) B<pseudocolor> is better than B<truecolor> or B<directcolor>,
107 which are better than B<staticcolor>, which is better than
108 B<staticgray> or B<grayscale>;
109 (d) the default visual for the screen is better than any other visual.
110
111 =back
112
113 =head1 CREDITS
114
115 The idea for B<Tk_GetVisual>, and the first implementation, came
116 from Paul Mackerras.
117
118 =head1 KEYWORDS
119
120 colormap, screen, visual