Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | New version of TIP #507 by René Zaumseil |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e709b1ffa65cc55e495c3b89ec18d20b |
User & Date: | fvogel 2018-12-03 19:20:50.307 |
Context
2018-12-06
| ||
13:54 | new TIP: 528 check-in: ee6f77054c user: jan.nijtmans tags: trunk | |
2018-12-03
| ||
19:20 | New version of TIP #507 by René Zaumseil check-in: e709b1ffa6 user: fvogel tags: trunk | |
07:59 | merge wordsmithing branch "kbk-527-redaction" check-in: 5dab3d4c27 user: sebres tags: trunk | |
Changes
Changes to index.json.
︙ | ︙ | |||
525 526 527 528 529 530 531 | "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": 527 | | | 525 526 527 528 529 530 531 532 | "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": 527 }, "@timestamp": 1543864539} |
Changes to tip/507.md.
︙ | ︙ | |||
8 9 10 11 12 13 14 | Keywords: Tk Tcl-Version: 8.7 Tk-Branch: tip-507 ----- # Abstract | | < | < | < < | | > > | < | | < < < < | | | | | > | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 | Keywords: Tk Tcl-Version: 8.7 Tk-Branch: tip-507 ----- # Abstract Tk needs scalable images on high resolution 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 image. 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 [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 be easily included - is really lightweight - is tested with tksvg - can render images - has no other external dependencies # Specification The already existing [tksvg][] extension will be adapted and included in Tk. A new image format will be created. The image format name is **svg**. The new format will support a small list of options. If there is a better implementation with p.e. full [SVG][] support, the interface can be reused and the limitations in the description can be removed. A description of the features and limitations of the current implementation is in section [Supported SVG](#Supported-SVG). It will be also described in the photo(n) man page. The **svg** image format has the following format suboptions: > **svg** **-dpi** _dpiValue_ **-scale** _scaleValue_ **-unit** _unitValue_ *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. 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 svg` triggers the error _"image string format "svg" is not supported"_; Tk cannot convert a photo image into an [SVG][]. 2. In this: $img configure -format {svg -scale 2} $img configure -format {svg -dpi 96} the second call takes `-scale` as the default value (1). <a name="Supported-SVG"></a> # Supported SVG The **svg** 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` |
︙ | ︙ | |||
155 156 157 158 159 160 161 | - `stop-opacity` - `offset` - `id` - `class` # Discussion | | > > > > > > > > > > > | > | > > | > > > > > > | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - `stop-opacity` - `offset` - `id` - `class` # Discussion In <http://code.activestate.com/lists/tcl-core/19994/> Francois Vogel mentioned his concerns. - A.1 Alternatives are described here at the end. - A.2 The interface is small (-format ...). Other, better implementations could provide it also. - A.3 is now described in section "Supported SVG" above. - A.4 The following, not necessary needed option will be removed: - **-x** *xValue* is used to move the created image in x-direction. The default value is 0. - **-y** *yValue* is used to move the created image in y-direction. The default value is 0. - B.3 **svg** - B.4 has the fix surfaced? - C is about better documentation Thread <http://code.activestate.com/lists/tcl-core/19871/> is about compilers. Thread <http://code.activestate.com/lists/tcl-core/19985/> was the last discussion. > <http://code.activestate.com/lists/tcl-core/20110/> and <http://code.activestate.com/lists/tcl-core/20111/> talk about a better solution, not using the **photo** comand and instead making a p.e. **svg** command with full functionality (especially writing). This is imho out of scope of this tip. It should be addressed in a separate tip. If done so the new function can then be used to support the functionality in this tip. There was some discussion on the further usage and maintenance of this image type. Here are the current state of the implementation in this area: - This tip will provide an **readonly** display of svg images with a **limited** set of funtionality described above. - The created image will have no information about the [SVG][] data and format options. - The included nanosvg header files will be remain diffable to the original ones. So changes in the original project can be ported to our implementation. - The format options will be limited to a minimum. So the implementation can later be substituted with a full [SVG][] compatible one. - If the implamenation will be replaced it will occur in a different tk version. So there is no need to create a scpecial variable describing the used [SVG][] implementation. - To further reduce the interface it is possible to remove the **-dpi** and **-unit** options. There is currently no demand for this. # 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. |
︙ | ︙ | |||
184 185 186 187 188 189 190 | <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 photo foo -data $data # change size | | | | | | > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | <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 photo foo -data $data # change size foo configure -format {svg -scale 2} # change dpi value foo configure -format {svg -dpi 96} # use other unit foo configure -format {svg -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. [nanosvg]: <https://github.com/memononen/nanosvg> [tksvg]: <https://github.com/auriocus/tksvg> [SVG]: <http://www.w3.org/TR/SVG11/> |