Files
effectcraft/crates/svg
Dylan M. Taylor 6ff564e750 SVG: bound tessellation, kept geometry, attributes, entity expansion and re-rendering (#2986)
* SVG: bound tessellation, kept geometry, attributes, entity expansion and re-rendering

Circles and rounded rects flattened at a fixed 0.01 tolerance, so a huge
radius made unbounded curves; the tolerance now grows with the radius as
arcs already did. Every path a <use> copies and every gradient reference's
stops were parsed and kept without a document-wide limit; both now share a
budget of 8 million items. An element with thousands of attributes made
the XML parser's duplicate check quadratic, and repeated entity references
could expand attribute text to gigabytes below the node limit; a preflight
refuses more than 1,024 attributes per element and entity references that
expand past 64 MiB. Nested knockout and non-isolated groups re-rendered
their children several times per level; node draws are now held to 64 per
node of the tree.

* address review: entity_bytes takes the largest declaration of each name

* address review: drop tessellation-tolerance, attribute-count and entity-size refusals; keep retained and draw budgets, warn when the draw budget is hit
2026-11-11 14:39:06 -05:00
..

effectcraft-svg

SVG import for EffectCraft: .svg files import as footage (rasterised at any scale, so Continuously Rasterize stays sharp) and Layer ▸ Create ▸ Create Shapes from Vector Layer turns them into editable shape layers.

Implemented from the W3C Scalable Vector Graphics (SVG) 1.1 (Second Edition) recommendation (16 August 2011) and the SVG 2 candidate recommendation (4 October 2018) for the parts listed here, plus CSS Color Module Level 3 for colour keywords and functions:

  • document: svg (width/height, viewBox, preserveAspectRatio), nested svg, g, defs, use (x/y, href / xlink:href), symbol (through use), title/desc/metadata ignored;
  • shapes: path (all path data commands incl. elliptical arcs), rect (rx/ry), circle, ellipse, line, polyline, polygon;
  • transform lists (matrix, translate, scale, rotate with centre, skewX, skewY);
  • painting: fill, fill-rule, fill-opacity, stroke, stroke-width, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-dasharray, stroke-dashoffset, stroke-opacity, opacity, display, visibility, color/currentColor;
  • linearGradient and radialGradient (with fx/fy focal point), gradientUnits, gradientTransform, spreadMethod, href inheritance of stops and attributes;
  • styling through presentation attributes, the style attribute and <style> sheets with type, class, id and universal selectors (simple selectors and selector lists).

Not supported (ignored): text, images, filters, clip paths, masks, patterns, markers, animation. XML parsing uses roxmltree (MIT/Apache-2.0). Test fixtures are original work (see tests/fixtures/*.attribution).