svg
Mojo module ðŸ¡
svg
A DrawTarget that accumulates resolution-independent SVG markup.
The surface implements every DrawTarget method. It is not a
general-purpose SVG builder: linear and radial gradients on rects and
paths only (a conic gradient has no SVG element and stays raster-only),
rectangle and path clips as nested <g clip-path> wrappers, and no
groups beyond those and begin_annotated_group.
The transform state (save/restore, translate/rotate/scale)
is carried as a transform="matrix(a b c d e f)" attribute on each
element drawn while a transform is set, rather than as nested <g>
groups: an attribute per element cannot interleave badly with the
annotated groups, and restore has nothing to close. draw_text’s own
rotation composes after it in the same attribute. SVG applies
stroke-width in the element’s user space, so a stroke under a scale
widens with it, as it does on Canvas.
set_blend_mode is carried the same way, as a
style="mix-blend-mode:..." attribute. CSS names the separable and
non-separable blend modes and nothing else, so the Porter-Duff
operators past the default – SOURCE, DESTINATION_IN, XOR and the
rest – emit no attribute and render as ordinary source-over.
Structs
SvgCanvas: Accumulates SVG body markup for awidth x heightdocument.width/heightare public fields, as onCanvas.