1Tk_GetDash(3) Tk Library Procedures Tk_GetDash(3)
2
3
4
5______________________________________________________________________________
6
8 Tk_GetDash - convert from string to valid dash structure.
9
11 #include <tk.h>
12
13 int
14 Tk_GetDash(interp, string, dashPtr)
15
17 Tcl_Interp *interp(in)
18 Interpreter to use for error reporting.
19
20 CONST char * string(in)
21 Textual value to be converted.
22
23 Tk_Dash *dashPtr (out) Points to place to store the dash pat‐
24 tern value converted from string.
25_________________________________________________________________
26
27
29 These procedure parses the string and fills in the result in the
30 Tk_Dash structure. The string can be a list of integers or a character
31 string containing only [.,-_] or spaces. If all goes well, TCL_OK is
32 returned. If string doesn't have the proper syntax then TCL_ERROR is
33 returned, an error message is left in the interpreter's result, and
34 nothing is stored at *dashPtr.
35
36 The first possible syntax is a list of integers. Each element repre‐
37 sents the number of pixels of a line segment. Only the odd segments are
38 drawn using the "outline" color. The other segments are drawn transpar‐
39 ent.
40
41 The second possible syntax is a character list containing only 5 possi‐
42 ble characters [.,-_ ]. The space can be used to enlarge the space
43 between other line elements, and can not occur as the first posibion in
44 the string. Some examples:
45 -dash . = -dash {2 4}
46 -dash - = -dash {6 4}
47 -dash -. = -dash {6 4 2 4}
48 -dash -.. = -dash {6 4 2 4 2 4}
49 -dash {. } = -dash {2 8}
50 -dash , = -dash {4 4}
51
52 The main difference of this syntax with the previous is that it it
53 shape-conserving. This means that all values in the dash list will be
54 multiplied by the line width before display. This assures that "." will
55 always be displayed as a dot and "-" always as a dash regardless of the
56 line width.
57
58 On systems where only a limited set of dash patterns, the dash pattern
59 will be displayed as the most close dash pattern that is available. For
60 example, on Windows only the first 4 of the above examples are avail‐
61 able. The last 2 examples will be displayed identically as the first
62 one.
63
64
66 dash, conversion
67
68
69
70Tk 8.3 Tk_GetDash(3)