Check-in [7c6da1bc85]

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:TIP 545 svg options: some refinements and EuroTCL discussion report
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7c6da1bc85ce5d9a4f93ef95637ec24a41abeff10829483e2ded394914a25677
User & Date: oehhar 2019-07-02 07:06:42
Context
2019-07-11
07:14
Make TIP align with actual current implementation check-in: a1fb82d376 user: jan.nijtmans tags: trunk
2019-07-02
07:06
TIP 545 svg options: some refinements and EuroTCL discussion report check-in: 7c6da1bc85 user: oehhar tags: trunk
2019-07-01
13:36
547 was accepted, and implemented check-in: 89820bd454 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to index.json.

548
549
550
551
552
553
554
555
	"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","obsoleted-by":"467","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","obsoleted-by":"386","post-history":"","state":"Withdrawn","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": 550
}, "@timestamp": 1561988180}






|
548
549
550
551
552
553
554
555
	"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","obsoleted-by":"467","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","obsoleted-by":"386","post-history":"","state":"Withdrawn","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": 550
}, "@timestamp": 1562051169}

Changes to tip/545.md.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134















135
136
137
138
# Abstract

Image photo SVG support was added to Tk by TIP 507.
This TIP is about the options of SVG rendering:

   *   The option "-unit" is not helpful in an environment, where the only destination unit is pixel.
   *   The option "-scale float" is the essential tool to set rendering scaling. Nevertheless, to scale to a given height or width, a two-step procedure is required. This common case should be implemented by a one step procedure.
   *   A valid image file scaled to a size below 0.5px or 0.5px does not lead to an error but to an image of 1x1 pixels. The aspect-ratio is not respected.

# Rationale

This TIP included two components:

## Remove option "-unit"

Remove the option "-unit".
The given unit is used to set the unit of the intermediate set of polygons.

The final unit will be pixels anyway, undependent on any intermediate unit.
................................................................................
    p configure [list svg -scale [expr {double($height) / $imageHeight}]

This two step procedure has a high performance impact, as the image is loaded twice.
The aim is to render it only once by one parameter.

## No error on to small scale

It feels odd to throw an error on a valid image but on a to small -scale parameter resulting in a rounded size of width 0 or height 0.
Alternatively, a valid image with size 1x1 is rendered.

As an alternate solution, an error message special for this case may be given.

# Specification

## Remove option "-unit"

................................................................................
    8

The entier argument must be greater than 0.
The option may not be specified together with "-scale" and/or "-scaletoheight".

## No error on to small scale

The image size is set to 1x1 if wether width or height is 0 after scaling and rounding.
This is a very rare case, as ceil rounding is used and we must go below the resolution of double to acheve this.

# Implementation

Implementation is ready in branch tip-545-svg-options.
















# Copyright

This document has been placed in the public domain.







|



|







 







|
|







 







|






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




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Abstract

Image photo SVG support was added to Tk by TIP 507.
This TIP is about the options of SVG rendering:

   *   The option "-unit" is not helpful in an environment, where the only destination unit is pixel.
   *   The option "-scale float" is the essential tool to set rendering scaling. Nevertheless, to scale to a given height or width, a two-step procedure is required. This common case should be implemented by a one step procedure.
   *   A valid image file scaled to a size resulting to 0 px height or width does not lead to an error but to an image of at least 1x1 pixels. The aspect-ratio may not be respected.

# Rationale

This TIP includes the following proposed changes:

## Remove option "-unit"

Remove the option "-unit".
The given unit is used to set the unit of the intermediate set of polygons.

The final unit will be pixels anyway, undependent on any intermediate unit.
................................................................................
    p configure [list svg -scale [expr {double($height) / $imageHeight}]

This two step procedure has a high performance impact, as the image is loaded twice.
The aim is to render it only once by one parameter.

## No error on to small scale

It feels odd to throw an error on a valid image but on a to small combination of size and -scale parameter resulting in a rounded size of width 0 or height 0.
Alternatively, a valid image with width 1 and/or height 1 is rendered.

As an alternate solution, an error message special for this case may be given.

# Specification

## Remove option "-unit"

................................................................................
    8

The entier argument must be greater than 0.
The option may not be specified together with "-scale" and/or "-scaletoheight".

## No error on to small scale

The image size is set to height 1 and/or width 1 if width and/or height is 0 after scaling and rounding.
This is a very rare case, as ceil rounding is used and we must go below the resolution of double to acheve this.

# Implementation

Implementation is ready in branch tip-545-svg-options.

# Discussion

This TIP was discussed at Euro-TCL 2019.

It was concluded that svg support is a good feature and helpful for modern gui design.
The limitations of nanosvg are seen as ok.

It was concluded that there is no use case for the -unit option.

Rene has another use-case for visual graph generation.
A svg file is created on the fly using the given data.
This is then rendered and displayed by a label widget.
This procedure is faster than the canvas or the tkpath widget (and has much less features).
This solution is a good fit to this application.

# Copyright

This document has been placed in the public domain.