Check-in [91d1a66aae]

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:TIP545: svg options: add information about current effect of -unit option
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 91d1a66aae4e4620a33fb85173057b57362ccaf36cb45953d8f8a8d710305809
User & Date: oehhar 2019-06-28 17:03:39
Context
2019-07-01
13:36
547 was accepted, and implemented check-in: 89820bd454 user: dkf tags: trunk
2019-06-28
17:03
TIP545: svg options: add information about current effect of -unit option check-in: 91d1a66aae user: oehhar tags: trunk
05:43
Added ready to run test binaries location check-in: ebea71473a user: rene 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": 1561195698}






|
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": 1561741243}

Changes to tip/545.md.

26
27
28
29
30
31
32































33
34
35
36
37
38
39
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.
Image width and height is in pixel.
There is no other unit available for image width or height.
































## Add a possibility to scale to a given width or height in pixels

A common usage of svg is to render button images for a given button height or width.
Buttons of applications may have all the same height or width when aranged in button lines aranged horizontally or vertically.

The current solution to render a svg to a given height "$height" is:






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







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
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.
Image width and height is in pixel.
There is no other unit available for image width or height.

The current implementation does the following:

   *   the intermediate representation is scaled in the unit given by "-unit" using the current dpi value. The result depends on the unit used in the svg, to specified unit and the dpi value (96 or specified by -dpi).
   *   the size of the image is evaluated by transforming the given unit into pixel
   *   the image data is rendered by assuming (not transforming: 1 inch is set to 1 pixel) that unit is pixel. If it was not pixel, a scale effect is shown by accident.

Here is an example from the core list:

    set data {<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle fill="yellow" stroke="red" cx="50" cy="50" r="30" /></svg>}
    set im [image create photo -data $data]
    pack [button .b -image $im]
    $im configure -format {svg -unit px}  ; # no change (this is the default)
    $im configure -format {svg -unit mm}  ; # image gets scaled to a smaller image, but image size stays the same

    # Set inner scale to one:
    $im configure -format {svg -unit in -dpi 1}
    image width $im
    -> 100
    # with the same result as no format option at all (e.g. "svg -unit px -dpi 96")
    
    # Set inner scale to 0.1, but keep same size
    $im configure -format {svg -unit in -dpi 10}
    image width $im
    -> 100
    # but image data is scale by factor 0.1
    
    # The standard way to get an image scaled by 0.1 but with size set to 100x100 is as follows:
    set im2 [image create photo -data $data -format {svg -scale 0.1} -width 100 -height 100]
    pack [button .b2 -image $im2]
</verbatim>

## Add a possibility to scale to a given width or height in pixels

A common usage of svg is to render button images for a given button height or width.
Buttons of applications may have all the same height or width when aranged in button lines aranged horizontally or vertically.

The current solution to render a svg to a given height "$height" is: