mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
557 stars 142 forks source link

Is it possible to NOT flatten the transformation matrices when saving the .svg output file? #184

Open Emasoft opened 2 years ago

Emasoft commented 2 years ago

Is it possible to NOT flatten the transformation matrices when saving the .svg output file? I'm doing this kind of steps for a project:

  1. read all parent groups of an svg element
  2. read all transforms matrices of the parent groups
  3. convert all svg transform matrices in numpy arrays
  4. concatenate all transforms in a single matrix using numpy matrix multiplication (@ operator)
  5. make a lot of numpy/scipy complex computations that ends producing a final numpy transform matrix
  6. apply this transform matrix to one or more groups of elements in the svg file but without applying the transform and flattening the paths
  7. save the resulting svg file (with the resulting transform matrix still explicitly written in the transform attribute of the parent group, so I can add or remove elements from the group, or move an element from a group to another, without any changes to the elements/paths).

Currently it is impossible to do this with the svgpathtools API.