<HTML><HEAD><TITLE>Library Procedures - Tk_GetPixels manual page</TITLE></HEAD><BODY> <DL> <DD><A HREF="GetPixels.htm#M2" NAME="L298">NAME</A> <DL><DD>Tk_GetPixels, Tk_GetScreenMM - translate between strings and screen units</DL> <DD><A HREF="GetPixels.htm#M3" NAME="L299">SYNOPSIS</A> <DL> </DL> <DD><A HREF="GetPixels.htm#M4" NAME="L300">ARGUMENTS</A> <DL> </DL> <DD><A HREF="GetPixels.htm#M5" NAME="L301">DESCRIPTION</A> <DL> <DD><A HREF="GetPixels.htm#M6" NAME="L302"><none></A> <DD><A HREF="GetPixels.htm#M7" NAME="L303"><B>c</B></A> <DD><A HREF="GetPixels.htm#M8" NAME="L304"><B>i</B></A> <DD><A HREF="GetPixels.htm#M9" NAME="L305"><B>m</B></A> <DD><A HREF="GetPixels.htm#M10" NAME="L306"><B>p</B></A> </DL> <DD><A HREF="GetPixels.htm#M11" NAME="L307">KEYWORDS</A> </DL><HR> <H3><A NAME="M2">NAME</A></H3> Tk_GetPixels, Tk_GetScreenMM - translate between strings and screen units <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tk.h></B><BR> int<BR> <B>Tk_GetPixels(</B><I>interp, tkwin, string, intPtr</I><B>)</B><BR> int<BR> <B>Tk_GetScreenMM(</B><I>interp, tkwin, string, doublePtr</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> Window whose screen geometry determines the conversion between absolute units and pixels. <P><DT>char <B>*string</B> (in)<DD> String that specifies a distance on the screen. <P><DT>int <B>*intPtr</B> (out)<DD> Pointer to location in which to store converted distance in pixels. <P><DT>double <B>*doublePtr</B> (out)<DD> Pointer to location in which to store converted distance in millimeters. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> These two procedures take as argument a specification of distance on the screen (<I>string</I>) and compute the corresponding distance either in integer pixels or floating-point millimeters. In either case, <I>string</I> specifies a screen distance as a floating-point number followed by one of the following characters that indicates units: <P> <DL> <P><DT><A NAME="M6"><none></A><DD> The number specifies a distance in pixels. <P><DT><A NAME="M7"><B>c</B></A><DD> The number specifies a distance in centimeters on the screen. <P><DT><A NAME="M8"><B>i</B></A><DD> The number specifies a distance in inches on the screen. <P><DT><A NAME="M9"><B>m</B></A><DD> The number specifies a distance in millimeters on the screen. <P><DT><A NAME="M10"><B>p</B></A><DD> The number specifies a distance in printer's points (1/72 inch) on the screen. <P></DL> <P> <B>Tk_GetPixels</B> converts <I>string</I> to the nearest even number of pixels and stores that value at <I>*intPtr</I>. <B>Tk_GetScreenMM</B> converts <I>string</I> to millimeters and stores the double-precision floating-point result at <I>*doublePtr</I>. <P> Both procedures return <B>TCL_OK</B> under normal circumstances. If an error occurs (e.g. <I>string</I> contains a number followed by a character that isn't one of the ones above) then <B>TCL_ERROR</B> is returned and an error message is left in <I>interp->result</I>. <H3><A NAME="M11">KEYWORDS</A></H3> <A href="../Keywords/C.htm#centimeters">centimeters</A>, <A href="../Keywords/C.htm#convert">convert</A>, <A href="../Keywords/I.htm#inches">inches</A>, <A href="../Keywords/M.htm#millimeters">millimeters</A>, <A href="../Keywords/P.htm#pixels">pixels</A>, <A href="../Keywords/P.htm#points">points</A>, <A href="../Keywords/S.htm#screen units">screen units</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1990 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>