Tk_GetVisual (3)
translate from string to visual
SYNOPSIS
#include <tk.h>
Visual *
Tk_GetVisual(interp, tkwin, string, depthPtr, colormapPtr)
ARGUMENTS
"Tcl_Interp" *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.
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
staticgray 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
'\"
'\" Copyright (c) 1990 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
'\" RCS: @(#) $Id: GetVRoot.3,v 1.2 1998/09/14 18:22:51 stanton Exp $
'\"
'\" The definitions below are for supplemental macros used in Tcl/Tk
'\" manual entries.
'\"
'\" .AP type name in/out ?indent?
'\" Start paragraph describing an argument to a library procedure.
'\" type is type of argument (int, etc.), in/out is either "in", "out",
'\" or "in/out" to describe whether procedure reads or modifies arg,
'\" and indent is equivalent to second arg of .IP (shouldn't ever be
'\" needed; use .AS below instead)
'\"
'\" .AS ?type? ?name?
'\" Give maximum sizes of arguments for setting tab stops. Type and
'\" name are examples of largest possible arguments that will be passed
'\" to .AP later. If args are omitted, default tab stops are used.
'\"
'\" .BS
'\" Start box enclosure. From here until next .BE, everything will be
'\" enclosed in one large box.
'\"
'\" .BE
'\" End of box enclosure.
'\"
'\" .CS
'\" Begin code excerpt.
'\"
'\" .CE
'\" End code excerpt.
'\"
'\" .VS ?version? ?br?
'\" Begin vertical sidebar, for use in marking newly-changed parts
'\" of man pages. The first argument is ignored and used for recording
'\" the version when the .VS was added, so that the sidebars can be
'\" found and removed when they reach a certain age. If another argument
'\" is present, then a line break is forced before starting the sidebar.
'\"
'\" .VE
'\" End of vertical sidebar.
'\"
'\" .DS
'\" Begin an indented unfilled display.
'\"
'\" .DE
'\" End of indented unfilled display.
'\"
'\" .SO
'\" Start of list of standard options for a Tk widget. The
'\" options follow on successive lines, in four columns separated
'\" by tabs.
'\"
'\" .SE
'\" End of list of standard options for a Tk widget.
'\"
'\" .OP cmdName dbName dbClass
'\" Start of description of a specific option. cmdName gives the
'\" option's name as specified in the class command, dbName gives
'\" the option's name in the option database, and dbClass gives
'\" the option's class in the option database.
'\"
'\" .UL arg1 arg2
'\" Print arg1 underlined, then print arg2 normally.
'\"
'\" RCS: @(#) $Id: man.macros,v 1.2 1998/09/14 18:39:54 stanton Exp $
'\"
'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
t .wh -1.3i ^B
^l \n(.l
b
'\" # Start an argument description
AP
!"\\$4"" .TP \\$4
\{\
!"\\$2"" .TP \\n()Cu
.TP 15
|