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

NAME

8       Tk_GetPixelsFromObj,  Tk_GetPixels,  Tk_GetMMFromObj,  Tk_GetScreenMM -
9       translate between strings and screen units
10

SYNOPSIS

12       #include <tk.h>
13
14       int
15       Tk_GetPixelsFromObj(interp, tkwin, objPtr, intPtr)
16
17       int
18       Tk_GetPixels(interp, tkwin, string, intPtr)
19
20       int
21       Tk_GetMMFromObj(interp, tkwin, objPtr, doublePtr)
22
23       int
24       Tk_GetScreenMM(interp, tkwin, string, doublePtr)
25

ARGUMENTS

27       Tcl_Interp *interp (in)           Interpreter to use for error  report‐
28                                         ing.
29
30       Tk_Window tkwin (in)              Window  whose  screen geometry deter‐
31                                         mines the conversion between absolute
32                                         units and pixels.
33
34       Tcl_Obj *objPtr (in/out)          String  value specifies a distance on
35                                         the screen; internal rep will be mod‐
36                                         ified to cache converted distance.
37
38       const char *string (in)           Same  as  objPtr except specification
39                                         of distance is passed as a string.
40
41       int *intPtr (out)                 Pointer to location in which to store
42                                         converted distance in pixels.
43
44       double *doublePtr (out)           Pointer to location in which to store
45                                         converted distance in millimeters.
46______________________________________________________________________________
47

DESCRIPTION

49       These procedures take as argument a specification of  distance  on  the
50       screen (objPtr or string) and compute the corresponding distance either
51       in integer pixels or floating-point millimeters.  In either  case,  ob‐
52       jPtr  or  string specifies a screen distance as a floating-point number
53       followed by one of the following characters that indicates units:
54
55       <none> The number specifies a distance in pixels.
56
57       c      The number specifies a distance in centimeters on the screen.
58
59       i      The number specifies a distance in inches on the screen.
60
61       m      The number specifies a distance in millimeters on the screen.
62
63       p      The number specifies a distance in printer's points (1/72  inch)
64              on the screen.
65
66       Tk_GetPixelsFromObj  converts  the  value of objPtr to the nearest even
67       number of pixels and stores that value at *intPtr.  It  returns  TCL_OK
68       under normal circumstances.  If an error occurs (e.g. objPtr contains a
69       number followed by a character that is not one of the ones above)  then
70       TCL_ERROR  is  returned and an error message is left in interp's result
71       if interp is not NULL.  Tk_GetPixelsFromObj  caches  information  about
72       the  return value in objPtr, which speeds up future calls to Tk_GetPix‐
73       elsFromObj with the same objPtr.
74
75       Tk_GetPixels is identical to Tk_GetPixelsFromObj except that the screen
76       distance  is  specified  with a string instead of an object.  This pre‐
77       vents Tk_GetPixels from caching the return value,  so  Tk_GetPixels  is
78       less efficient than Tk_GetPixelsFromObj.
79
80       Tk_GetMMFromObj  and  Tk_GetScreenMM are similar to Tk_GetPixelsFromObj
81       and Tk_GetPixels (respectively) except that  they  convert  the  screen
82       distance to millimeters and store a double-precision floating-point re‐
83       sult at *doublePtr.
84

KEYWORDS

86       centimeters, convert, inches, millimeters, pixels, points, screen units
87
88
89
90Tk                                    8.1               Tk_GetPixelsFromObj(3)
Impressum