Chapter 5. SVG Import and Code Generation

Table of Contents


Counterpart to the svgdumper.tcl module. This module takes an SVG DOM Tree and converts it into Tcl-Code. This Tcl-Code creates vector graphic objects inside a »pathCanvas« window. TkPath 0.3 is required for using the generated Tcl-Code.

SVG - dumper requires local data for a series of elements. Notable images. Converting images is much easier toward Tcl. They are always global. Fonts are directly translated. This code here cannot deal with SVG embedded fonts. Gradients will be troublesome. There is no secure way to identify them inside of Tcl, likely a storage variable named after the SVG should be used to identify the gradient. set $linear666 »gradient«

Zinc, tkpParser is –almost– independent from TkPath and completely independent from Tcl. Writing a zincDumper requires to substitute the TkPath elements with their zinc counterpart. E.g. text instead of ptext. SVG (viewports) can be implemented by a simple group in zinc, since any zinc object creates its own viewport. In this respect zinc is even more advanced than SVG.

The Package gtkp is located inside the RTL. Its purpose is to provide universal access to TkPath 0.2.4 and 0.3 transformations. At least one version of TkPath must be installed to create the transformation matrix.