Check-in [8331611a7f]

Login

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

Overview
Comment:examples and docu of tip 507 added
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8331611a7fb3683f3de7c7850d5296e85f91a950393f7a694ec974882704fd29
User & Date: rene 2018-06-13 20:50:54.812
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
Unified Diff Ignore Whitespace Patch
Changes to tip/507.md.
26
27
28
29
30
31
32
















33
34
35
36
37
38
39
40
41
42
43
44

45





















46
47
48
49
50
51
52
The original nanosvg project is hosted at https://github.com/memononen/nanosvg

# Specification

The already existing tksvg extension will be adapted and included in Tk.
A new image format will be created. The name is **svgnano**.

















# Discussion

- nanosvg is no full svg library
- the name of the image format should mention this (p.e. **nanosvg** or
**svgnano**)
- are there better libraries with our requirements (C only, license)?

# Implementation

A patch implementing these changes will be available in the fossil repository in the [tip-507 branch]
(https://core.tcl.tk/tk/timeline?r=tip-507).


Documentation updates not yet done.






















# Alternatives

- using another library with full svg support

# Copyright








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
The original nanosvg project is hosted at https://github.com/memononen/nanosvg

# Specification

The already existing tksvg extension will be adapted and included in Tk.
A new image format will be created. The name is **svgnano**.

The **svgnano** image format has the following format suboptions:

**svgnano** *-dpi dpiValue -scale scaleValue -unit unitValue -x xValue -y yValue*

*dpiValue* is used in conversion between given coordiantes and screen resolution. The value must be greater then 0.0. The default value is 96.

*scaleValue* is used to scale the resulting image. The value must be greater then 0.0. The default value is 1.

*unitValue* is the unit of all coordinates in the svg data. Available units are px (default, coordinates in pixel), mm , cm and in.

*xValue* is used to move the created image in x-direction. The default value is 0.

*yValue* is used to move the created image in y-direction. The default value is 0.
.
The svgnano format supports a wide range of SVG features, but something may be missing p.e. text.

# Discussion

- nanosvg is no full svg library
- the name of the image format should mention this (p.e. **nanosvg** or
**svgnano**)
- are there better libraries with our requirements (C only, license)?

# Implementation

A patch implementing these changes will be available in the fossil repository in the [tip-507 branch]
(https://core.tcl.tk/tk/timeline?r=tip-507).

The new format is in the photo.n man page described.

# Example of use

	    # the image data
	    set data {<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
	    <path fill="none" stroke="#000000" d="M0 0 h16 v16 h-16 z"/>
	    <path fill="none" stroke="#000000" d="M8 4 v 8 M4 8 h 8"/>
	    <circle fill="yellow" stroke="red" cx="10" cy="80" r="10" />
	    <ellipse fill="none" stroke="blue" stroke-width="3" cx="60" cy="60" rx="10" ry="20" />
	    <line x1="10" y1="90" x2="50" y2="99"/>
	    <rect fill="none" stroke="green"  x="20" y="20" width="60" height="50" rx="3" ry="3"/>
	    <polyline fill="red" stroke="purple" points="80,10 90,20 85,40"/>
	    <polygon fill ="yellow" points="80,80 70,85 90,90"/>
	    </svg>}
	    # create image
	    image create foo -data $data
	    # change size
	    foo configure -format {svgnano -scale 2}
	    # move right and up, all other values are reset
	    foo configure -format {svgnano -x 10 -y -20}
	    # use other unit
	    foo configure -format {svgnano -unit mm}

# Alternatives

- using another library with full svg support

# Copyright