Check-in [d0f56ff80a]

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

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

Overview
Comment:Record the outcome of the recent discussions about TIP #507
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d0f56ff80a7e921632e272d8cb8bea9922e2d8bdd2ea9fc5aafd3b5ed665437f
User & Date: fvogel 2018-09-22 14:37:21
Context
2018-09-22
18:06
Added pointer to tip474 documentation check-in: 9924b58416 user: oehhar tags: trunk
14:37
Record the outcome of the recent discussions about TIP #507 check-in: d0f56ff80a user: fvogel tags: trunk
2018-09-21
09:51
Updated TIP 452 to be for 8.7; its implementation has always been that way. check-in: 98da8e6d65 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to index.json.

515
516
517
518
519
520
521
522
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news comp.lang.tcl","author":["Brent Welch <[email protected]>","Donal K. Fellows <[email protected]>","Larry W. Virden <[email protected]>","Larry W. Virden <[email protected]>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected].ac.uk>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>","Don Porter <[email protected]>","Mo DeJong <[email protected]>","Larry W. Virden <[email protected]>","Kevin Kenny <[email protected]>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <[email protected]>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <[email protected]>"],"is-jest":false},
	"@min": 0,
	"@max": 517
}, "@timestamp": 1537523417}






|
515
516
517
518
519
520
521
522
	"4":{"url":"./tip/4.md","created":"26-Oct-2000","post-history":"","state":"Draft","vote":"Pending","type":"Informative","title":"# TIP 4: Tcl Release and Distribution Philosophy","discussions-to":"news comp.lang.tcl","author":["Brent Welch <[email protected]>","Donal K. Fellows <[email protected]>","Larry W. Virden <[email protected]>","Larry W. Virden <[email protected]>"],"is-jest":false},
	"3":{"url":"./tip/3.md","created":"14-Sep-2000","post-history":"","state":"Accepted","vote":"Done","type":"Process","title":"# TIP 3: TIP Format","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>"],"is-jest":false},
	"2":{"url":"./tip/2.md","created":"12-Sep-2000","post-history":"","state":"Draft","vote":"Pending","type":"Process","title":"# TIP 2: TIP Guidelines","author":["Andreas Kupries <[email protected]>","Donal K. Fellows <[email protected]>","Don Porter <[email protected]>","Mo DeJong <[email protected]>","Larry W. Virden <[email protected]>","Kevin Kenny <[email protected]>"],"is-jest":false},
	"1":{"url":"./tip/1.md","created":"14-Sep-2000","post-history":"","state":"Active","vote":"No voting","type":"Informational","title":"# TIP 1: TIP Index","author":["TIP Editor <[email protected]>"],"is-jest":false},
	"0":{"url":"./tip/0.md","created":"11-Dec-2000","post-history":"","state":"Final","vote":"Done","type":"Process","title":"# TIP 0: Tcl Core Team Basic Rules","author":["John Ousterhout <[email protected]>"],"is-jest":false},
	"@min": 0,
	"@max": 517
}, "@timestamp": 1537626994}

Changes to tip/507.md.

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
...
181
182
183
184
185
186
187
188


189
190
191
192
	Post-History:   
	Keywords:       Tk
	Tcl-Version:    8.7
-----

# Abstract

Tk needs scalable images on high res mobile devices.

# Rationale

Tk is running on desktop and mobile devices. The out of the box image formats
do not scale and are to tiny on high res mobile devices.
The same goes for the image formats provided by the img extension.

There is already an tk image extension at https://github.com/auriocus/tksvg
The implementation is using nanosvg. It has no other external dependencies
and is only 2 header files.

**nanosvg** was choosen because it:

- has a suitable license
- is written in 2 plain C header files and can easily included
................................................................................

**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 given format options are only used at creation time of the image and are not preserved in the image.





# Supported SVG

The svgnano format supports a wide range of SVG features, but something may be missing p.e. text.

## Elements

- g
- path
- rect
- circle
................................................................................

## Poly Attributes

- points

## Line Attributes

- x1, y1, x2, xy2

## Ellipse Attributes

- cx, cy
- rx, ry

## Circle Attributes
................................................................................
# Discussion

- http://code.activestate.com/lists/tcl-core/19871/
- http://code.activestate.com/lists/tcl-core/19994/

## Open questions

- are all of the above format options necessary? May be remove the *xValue* abd *yValue* options.

# Implementation

A patch implementing these changes is 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"/>
................................................................................
	    # 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

This document has been placed in the public domain.






|







|







 







|




|
|
>
>
>
>



|







 







|







 







|






|







 







|
>
>




7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
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
...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	Post-History:   
	Keywords:       Tk
	Tcl-Version:    8.7
-----

# Abstract

Tk needs scalable images on high res mobile devices. This TIP proposes to let Tk be able to read an SVG image (plus information about orientation and pixel scale) and make it into a photo. It is therefore a (lossy and single direction) conversion operation from an SVG format to a pixel format.

# Rationale

Tk is running on desktop and mobile devices. The out of the box image formats
do not scale and are to tiny on high res mobile devices.
The same goes for the image formats provided by the img extension.

There is already a Tk image extension at https://github.com/auriocus/tksvg
The implementation is using nanosvg. It has no other external dependencies
and is only 2 header files.

**nanosvg** was choosen because it:

- has a suitable license
- is written in 2 plain C header files and can easily included
................................................................................

**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), pt (1/72 inch), pc (12 pt), 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 given format options are only used at creation time of the image and are not preserved in the image. This means that:

  1. **$img data -format svgnano** triggers error **"image string format "svgnano" is not supported"**
  
  2. **$img configure -format {svgnano -scale 2} ; $img configure -format {svgnano -x 10}    ;** # the second call takes -scale as the default value (1)

# Supported SVG

The svgnano format supports a wide range of SVG features, however some features (e.g. 'text') are missing and silently ignored when reading the SVG data.

## Elements

- g
- path
- rect
- circle
................................................................................

## Poly Attributes

- points

## Line Attributes

- x1, y1, x2, y2

## Ellipse Attributes

- cx, cy
- rx, ry

## Circle Attributes
................................................................................
# Discussion

- http://code.activestate.com/lists/tcl-core/19871/
- http://code.activestate.com/lists/tcl-core/19994/

## Open questions

- Are all of the above format options necessary? May be remove the *xValue* and *yValue* options.

# Implementation

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

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

# 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"/>
................................................................................
	    # 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

- Use of another library with full svg support instead of the current proposal for partial support: could be done as a further step.

- Direct manipulation of SVG vector graphics (as opposed to the present proposal of converting SVG to pixel format in a photo) would be desirable. However this can always be done later, for instance in the frame of the canvas widget. It is deemed an already large improvement to have Tk be able to read SVG images and convert them to pixel-based photos.

# Copyright

This document has been placed in the public domain.