Debian Codegraph @

pod/pTk/GetPixels.pod

raw
1 # Copyright (c) 1990 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk::pTk::GetPixels, Tk::pTk::GetScreenMM - translate between strings and screen units
11
12 =for category C Programming
13
14 =head1 SYNOPSIS
15
16 B<#include E<lt>tk.hE<gt>>
17
18 int
19 B<Tk_GetPixels(>I<interp, tkwin, string, intPtr>B<)>
20
21 int
22 B<Tk_GetScreenMM(>I<interp, tkwin, string, doublePtr>B<)>
23
24 =head1 ARGUMENTS
25
26 =over 4
27
28 =item Tcl_Interp *interp (in)
29
30 Interpreter to use for error reporting.
31
32 =item Tk_Window tkwin (in)
33
34 Window whose screen geometry determines the conversion between absolute
35 units and pixels.
36
37 =item char *string (in)
38
39 String that specifies a distance on the screen.
40
41 =item int *intPtr (out)
42
43 Pointer to location in which to store converted distance in pixels.
44
45 =item double *doublePtr (out)
46
47 Pointer to location in which to store converted distance in millimeters.
48
49 =back
50
51 =head1 DESCRIPTION
52
53 These two procedures take as argument a specification of distance on
54 the screen (I<string>) and compute the corresponding distance
55 either in integer pixels or floating-point millimeters.
56 In either case, I<string> specifies a screen distance as a
57 floating-point number followed by one of the following characters
58 that indicates units:
59
60 =over 4
61
62 =item E<lt>noneE<gt>
63
64 The number specifies a distance in pixels.
65
66 =item B<c>
67
68 The number specifies a distance in centimeters on the screen.
69
70 =item B<i>
71
72 The number specifies a distance in inches on the screen.
73
74 =item B<m>
75
76 The number specifies a distance in millimeters on the screen.
77
78 =item B<p>
79
80 The number specifies a distance in printer's points (1/72 inch)
81 on the screen.
82
83 B<Tk_GetPixels> converts I<string> to the nearest even
84 number of pixels and stores that value at I<*intPtr>.
85 B<Tk_GetScreenMM> converts I<string> to millimeters and
86 stores the double-precision floating-point result at I<*doublePtr>.
87
88 Both procedures return B<TCL_OK> under normal circumstances.
89 If an error occurs (e.g. I<string> contains a number followed
90 by a character that isn't one of the ones above) then
91 B<TCL_ERROR> is returned and an error message is left
92 in I<interp-E<gt>result>.
93
94 =back
95
96 =head1 KEYWORDS
97
98 centimeters, convert, inches, millimeters, pixels, points, screen units