Files
svg-tools/docs/TRANSFORM_MODEL.md
T

2.6 KiB

Transform model

SVG transform functions are parsed without changing order: matrix, translate, scale, rotate (with optional center), skewX and skewY. The inspector shows each selected/ancestor source transform, accumulated matrix, determinant/invertibility diagnostics and the candidate matrix.

A draft combines translate, origin, rotate, scale and skew. It affects only the iframe/overlay until Apply. The proposed source and rendering are shown before one revision-checked transaction; undo restores the exact pre-apply text.

Bake support

Element Supported result
path all segment points transformed; arcs retained for safe conformal cases or converted/disclosed when required
line transformed endpoints, remains line
polyline, polygon transformed point list, same element
rect remains rect for axis-aligned safe cases; otherwise candidate path
circle remains circle under conformal scale; otherwise explicit ellipse/path as required
ellipse remains ellipse for safe axis-aligned cases; otherwise path

Numbers remain full precision internally and are serialized with stable bounded precision only at the explicit operation boundary. Invalid/non-finite geometry, negative radii and unsupported element types fail before patch creation.

Policies and limits

  • Non-conformal transforms with a visible stroke produce a warning; stroke width/vector-effect is not silently rewritten.
  • General arc conversion is disclosed in the preview.
  • Shared gradients, patterns, markers, filters, masks and clips are indexed but not cloned or remapped during bake.
  • Text transforms remain attributes; text-to-path is not implemented.
  • Group flattening and partial multi-child baking are not implemented.
  • Consolidation is available through an appended matrix candidate; a full editable transform-list UI/decomposition is future work.

Browser rendering, particularly text and filters, is the visual oracle; the unit suite checks matrix and geometry invariants but does not claim pixel-perfect equivalence for every renderer.