<HTML><HEAD><TITLE>Tk Library Procedures - Tk_GetVisual manual page</TITLE></HEAD><BODY> <DL> <DD><A HREF="GetVisual.htm#M2" NAME="L343">NAME</A> <DL><DD>Tk_GetVisual - translate from string to visual</DL> <DD><A HREF="GetVisual.htm#M3" NAME="L344">SYNOPSIS</A> <DL> </DL> <DD><A HREF="GetVisual.htm#M4" NAME="L345">ARGUMENTS</A> <DL> </DL> <DD><A HREF="GetVisual.htm#M5" NAME="L346">DESCRIPTION</A> <DL> <DD><A HREF="GetVisual.htm#M6" NAME="L347"><I>class depth</I></A> <DD><A HREF="GetVisual.htm#M7" NAME="L348"><B>default</B></A> <DD><A HREF="GetVisual.htm#M8" NAME="L349"><I>pathName</I></A> <DD><A HREF="GetVisual.htm#M9" NAME="L350"><I>number</I></A> <DD><A HREF="GetVisual.htm#M10" NAME="L351"><B>best</B> ?<I>depth</I>?</A> </DL> <DD><A HREF="GetVisual.htm#M11" NAME="L352">CREDITS</A> <DD><A HREF="GetVisual.htm#M12" NAME="L353">KEYWORDS</A> </DL><HR> <H3><A NAME="M2">NAME</A></H3> Tk_GetVisual - translate from string to visual <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tk.h></B><BR> Visual *<BR> <B>Tk_GetVisual(</B><I>interp, tkwin, string, depthPtr, colormapPtr</I><B>)</B><BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD> Interpreter to use for error reporting. <P><DT>Tk_Window <B>tkwin</B> (in)<DD> Token for window in which the visual will be used. <P><DT>char <B>*string</B> (in)<DD> String that identifies the desired visual. See below for valid formats. <P><DT>int <B>*depthPtr</B> (out)<DD> Depth of returned visual gets stored here. <P><DT>Colormap <B>*colormapPtr</B> (out)<DD> If non-NULL then a suitable colormap for visual is found and its identifier is stored here. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> <B>Tk_GetVisual</B> takes a string description of a visual and finds a suitable X Visual for use in <I>tkwin</I>, 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 <I>*depthPtr</I>. If <I>string</I> is unrecognizable or if no suitable visual could be found, then NULL is returned and <B>Tk_GetVisual</B> leaves an error message in <I>interp->result</I>. If <I>colormap</I> is non-NULL then <B>Tk_GetVisual</B> also locates an appropriate colormap for use with the result visual and stores its X identifier at <I>*colormapPtr</I>. <P> The <I>string</I> argument specifies the desired visual in one of the following ways: <P> <DL> <P><DT><A NAME="M6"><I>class depth</I></A><DD> The string consists of a class name followed by an integer depth, with any amount of white space (including none) in between. <I>class</I> selects what sort of visual is desired and must be one of <B>directcolor</B>, <B>grayscale</B>, <B>greyscale</B>, <B>pseudocolor</B>, <B>staticcolor</B>, <B>staticgray</B>, <B>staticgrey</B>, or <B>truecolor</B>, or a unique abbreviation. <I>depth</I> specifies how many bits per pixel are needed for the visual. If possible, <B>Tk_GetVisual</B> will return a visual with this depth; if there is no visual of the desired depth then <B>Tk_GetVisual</B> looks first for a visual with greater depth, then one with less depth. <P><DT><A NAME="M7"><B>default</B></A><DD> Use the default visual for <I>tkwin</I>'s screen. <P><DT><A NAME="M8"><I>pathName</I></A><DD> Use the visual for the window given by <I>pathName</I>. <I>pathName</I> must be the name of a window on the same screen as <I>tkwin</I>. <P><DT><A NAME="M9"><I>number</I></A><DD> Use the visual whose X identifier is <I>number</I>. <P><DT><A NAME="M10"><B>best</B> ?<I>depth</I>?</A><DD> 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 <I>depth</I> is specified, then the deepest available visual is chosen; (c) <B>pseudocolor</B> is better than <B>truecolor</B> or <B>directcolor</B>, which are better than <B>staticcolor</B>, which is better than <B>staticgray</B> or <B>grayscale</B>; (d) the default visual for the screen is better than any other visual. <P></DL> <H3><A NAME="M11">CREDITS</A></H3> The idea for <B>Tk_GetVisual</B>, and the first implementation, came from Paul Mackerras. <H3><A NAME="M12">KEYWORDS</A></H3> <A href="../Keywords/C.htm#colormap">colormap</A>, <A href="../Keywords/S.htm#screen">screen</A>, <A href="../Keywords/V.htm#visual">visual</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1994 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>