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)                                        │
35                                         String  value specifies a distance on │
36                                         the screen; internal rep will be mod‐ │
37                                         ified to cache converted distance.    │
38
39       CONST char   *string    (in)                                            │
40                                         Same  as  objPtr except specification │
41                                         of distance is passed as a string.
42
43       int          *intPtr    (out)     Pointer to location in which to store
44                                         converted distance in pixels.
45
46       double       *doublePtr (out)     Pointer to location in which to store
47                                         converted distance in millimeters.
48_________________________________________________________________
49
50

DESCRIPTION

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

KEYWORDS

90       centimeters, convert, inches, millimeters, pixels, points, screen units
91
92
93
94Tk                                    8.1               Tk_GetPixelsFromObj(3)
Impressum