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

NAME

8       Tk_GetDash - convert from string to valid dash structure.
9

SYNOPSIS

11       #include <tk.h>
12
13       int
14       Tk_GetDash(interp, string, dashPtr)
15

ARGUMENTS

17       Tcl_Interp *interp (in)        Interpreter to use for error reporting.
18
19       const char *string (in)        Textual value to be converted.
20
21       Tk_Dash *dashPtr (out)         Points  to  place to store the dash pat‐
22                                      tern value converted from  string.  Must
23                                      not be NULL.
24______________________________________________________________________________
25

DESCRIPTION

27       These  procedure  parses  the  string  and  fills  in the result in the
28       Tk_Dash structure. The string can be a list of integers or a  character
29       string  containing  only “.,-_” and spaces. If all goes well, TCL_OK is
30       returned and a dash descriptor is stored in the variable pointed to  by
31       dashPtr.   If  string does not have the proper syntax then TCL_ERROR is
32       returned, an error message is left in  the  interpreter's  result,  and
33       nothing is stored at *dashPtr.
34
35       The  first  possible  syntax is a list of integers. Each element repre‐
36       sents the number of pixels of a line segment. Only the odd segments are
37       drawn using the “outline” color. The other segments are drawn transpar‐
38       ent.
39
40       The second possible syntax is a character list containing only 5 possi‐
41       ble  characters  “.,-_  ”.   The space can be used to enlarge the space
42       between other line elements, and can not occur in the first position of
43       the string. Some examples:
44
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 between this syntax and the numeric is that it is
53       shape-conserving. This means that all values in the dash list  will  be
54       multiplied  by  the  line  width  before display. This ensures that “.”
55       will always be displayed as a dot and “-” always as a  dash  regardless
56       of the 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  to  the  first
62       one.
63

SEE ALSO

65       canvas(n), Tk_CreateItemType(3)
66

KEYWORDS

68       dash, conversion
69
70
71
72Tk                                    8.3                        Tk_GetDash(3)
Impressum