tsvg

Difference between version 3 and 4 - Previous - Next
<<toc>>

----

**Name**
''tsvg'' - Thingy SVG writer - package to create svg image files with a syntax close to Tcl and to SVG. Using *cairosvg* writing PDF and PNG files is as well possible.

**Description**
[DDG] 2021-08-30: The package provides one command ''tsvg'' which can hold currently just a single svg code collection. All commands will be evaluated within the tsvg namespace, all unknown methods will be forwarded to the standard tsvg::tag method and produce svg code out of them. So `tsvg dummy x="20" hello` will produce: `<dummy x="20">hello</dummy>` as output. If the tool https://cairosvg.org/%|%cairosvg%|% is installed as well PNG and PDF files can be written since version 0.3.0.

**Links**

    * Homepage: https://github.com/mittelmark/DGTcl
    * Download: (Gitdown) https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/pandoc-tcl-filter/lib/tsvg
    * Manual: https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html
    * Version: 0.3.0 - 2021-12-01
    * License: MIT

**Example**

Below a simple example to create a "Hello World!" figure:

======
package require tsvg
tsvg circle cx 50 cy 50 r 45 stroke black stroke-width 2 fill salmon
tsvg text x 29 y 45 Hello
tsvg text x 27 y 65 World!
tsvg write hello-world.svg
======

[tsvg-image]

For more examples see the https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/pandoc-tcl-filter/lib/tsvg/tsvg.html%|%manual page%|%.

----

**See also**

   * [Thingy: a one-liner OO system] - the toy OO behind *tsvg*
   * [tclcairo] - an other graphics library
   * [tdot] a thingy object to write [GraphViz] dot files

----

**Discussion**

[DDG] - 2021-12-01 - Version 0.3.0 adds support for writing PNG and PDF files using an installation of ''cairosvg''



<<categories>> Package | Graphics | SVG | PDF | PNG