Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Tk_GetDash (3tk)

Name

Tk_GetDash - convert from string to valid dash structure.

Synopsis

#include <tk.h>

int
Tk_GetDash(interp, string, dashPtr)

Description

Tk_GetDash(3tk)              Tk Library Procedures             Tk_GetDash(3tk)



______________________________________________________________________________

NAME
       Tk_GetDash - convert from string to valid dash structure.

SYNOPSIS
       #include <tk.h>

       int
       Tk_GetDash(interp, string, dashPtr)

ARGUMENTS
       Tcl_Interp *interp (in)        Interpreter to use for error reporting.

       const char *string (in)        Textual value to be converted.

       Tk_Dash *dashPtr (out)         Points  to  place to store the dash pat-
                                      tern value converted from  string.  Must
                                      not be NULL.
______________________________________________________________________________

DESCRIPTION
       These  procedure  parses  the  string  and  fills  in the result in the
       Tk_Dash structure. The string can be a list of integers or a  character
       string  containing  only ".,-_" and spaces. If all goes well, TCL_OK is
       returned and a dash descriptor is stored in the variable pointed to  by
       dashPtr.   If  string does not have the proper syntax then TCL_ERROR is
       returned, an error message is left in  the  interpreter's  result,  and
       nothing is stored at *dashPtr.

       The  first  possible  syntax is a list of integers. Each element repre-
       sents the number of pixels of a line segment. Only the odd segments are
       drawn using the "outline" color. The other segments are drawn transpar-
       ent.

       The second possible syntax is a character list containing only 5 possi-
       ble  characters  ".,-_  ".   The space can be used to enlarge the space
       between other line elements, and can not occur in the first position of
       the string. Some examples:

                  -dash .     = -dash {2 4}
                  -dash -     = -dash {6 4}
                  -dash -.    = -dash {6 4 2 4}
                  -dash -..   = -dash {6 4 2 4 2 4}
                  -dash {. }  = -dash {2 8}
                  -dash ,     = -dash {4 4}

       The  main  difference between this syntax and the numeric is that it is
       shape-conserving. This means that all values in the dash list  will  be
       multiplied  by  the  line  width  before display. This ensures that "."
       will always be displayed as a dot and "-" always as a  dash  regardless
       of the line width.

       On  systems where only a limited set of dash patterns, the dash pattern
       will be displayed as the most close dash pattern that is available. For
       example,  on  Windows only the first 4 of the above examples are avail-
       able; the last 2 examples will be displayed identically  to  the  first
       one.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+------------------+
       |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
       +---------------+------------------+
       |Availability   | runtime/tk-8     |
       +---------------+------------------+
       |Stability      | Uncommitted      |
       +---------------+------------------+

SEE ALSO
       canvas(n), Tk_CreateItemType(3)

KEYWORDS
       dash, conversion



NOTES
       Source  code  for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This     software     was    built    from    source    available    at
       https://github.com/oracle/solaris-userland.   The  original   community
       source        was        downloaded        from         https://source-
       forge.net/projects/tcl/files/Tcl/8.6.7/tk8.6.7-src.tar.gz/download.

       Further information about this software can be found on the open source
       community website at https://www.tcl.tk/.



Tk                                    8.3                      Tk_GetDash(3tk)