Check-in [8331611a7f]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:examples and docu of tip 507 added
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:8331611a7fb3683f3de7c7850d5296e85f91a950393f7a694ec974882704fd29
User & Date: rene 2018-06-13 20:50:54
Context
2018-06-14
13:51
Working on improving TIP 478 check-in: a0932d4977 user: dkf tags: trunk
2018-06-13
20:50
examples and docu of tip 507 added check-in: 8331611a7f user: rene tags: trunk
2018-06-10
20:49
Fix some spelling and awkward wording check-in: 52d37fea35 user: dkf tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tip/507.md.

    26     26   The original nanosvg project is hosted at https://github.com/memononen/nanosvg
    27     27   
    28     28   # Specification
    29     29   
    30     30   The already existing tksvg extension will be adapted and included in Tk.
    31     31   A new image format will be created. The name is **svgnano**.
    32     32   
           33  +The **svgnano** image format has the following format suboptions:
           34  +
           35  +**svgnano** *-dpi dpiValue -scale scaleValue -unit unitValue -x xValue -y yValue*
           36  +
           37  +*dpiValue* is used in conversion between given coordiantes and screen resolution. The value must be greater then 0.0. The default value is 96.
           38  +
           39  +*scaleValue* is used to scale the resulting image. The value must be greater then 0.0. The default value is 1.
           40  +
           41  +*unitValue* is the unit of all coordinates in the svg data. Available units are px (default, coordinates in pixel), mm , cm and in.
           42  +
           43  +*xValue* is used to move the created image in x-direction. The default value is 0.
           44  +
           45  +*yValue* is used to move the created image in y-direction. The default value is 0.
           46  +.
           47  +The svgnano format supports a wide range of SVG features, but something may be missing p.e. text.
           48  +
    33     49   # Discussion
    34     50   
    35     51   - nanosvg is no full svg library
    36     52   - the name of the image format should mention this (p.e. **nanosvg** or
    37     53   **svgnano**)
    38     54   - are there better libraries with our requirements (C only, license)?
    39     55   
    40     56   # Implementation
    41     57   
    42     58   A patch implementing these changes will be available in the fossil repository in the [tip-507 branch]
    43     59   (https://core.tcl.tk/tk/timeline?r=tip-507).
    44     60   
    45         -Documentation updates not yet done.
           61  +The new format is in the photo.n man page described.
           62  +
           63  +# Example of use
           64  +
           65  +	    # the image data
           66  +	    set data {<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
           67  +	    <path fill="none" stroke="#000000" d="M0 0 h16 v16 h-16 z"/>
           68  +	    <path fill="none" stroke="#000000" d="M8 4 v 8 M4 8 h 8"/>
           69  +	    <circle fill="yellow" stroke="red" cx="10" cy="80" r="10" />
           70  +	    <ellipse fill="none" stroke="blue" stroke-width="3" cx="60" cy="60" rx="10" ry="20" />
           71  +	    <line x1="10" y1="90" x2="50" y2="99"/>
           72  +	    <rect fill="none" stroke="green"  x="20" y="20" width="60" height="50" rx="3" ry="3"/>
           73  +	    <polyline fill="red" stroke="purple" points="80,10 90,20 85,40"/>
           74  +	    <polygon fill ="yellow" points="80,80 70,85 90,90"/>
           75  +	    </svg>}
           76  +	    # create image
           77  +	    image create foo -data $data
           78  +	    # change size
           79  +	    foo configure -format {svgnano -scale 2}
           80  +	    # move right and up, all other values are reset
           81  +	    foo configure -format {svgnano -x 10 -y -20}
           82  +	    # use other unit
           83  +	    foo configure -format {svgnano -unit mm}
    46     84   
    47     85   # Alternatives
    48     86   
    49     87   - using another library with full svg support
    50     88   
    51     89   # Copyright
    52     90   
    53     91   This document has been placed in the public domain.