Expand description
Helpers for SVG output: number/colour formatting, path data, contour tracing of SDF bitmaps (glyph and SDF-icon outlines), and embedded images.
Functionsยง
- alpha
- Format an opacity (4 decimals: 2 would shift translucent fills by up to 1/255 per layer).
- base64
- Standard base64 (for data: URIs).
- num
- Format a coordinate compactly (2 decimals, trailing zeros trimmed).
- paint
- A premultiplied colour (times an opacity) as SVG
#rrggbb+ opacity. - path_
data - Path data for closed rings / open polylines.
- png_
data_ uri - Encode straight-alpha RGBA as a PNG data URI.
- trace_
contours - Iso-contours of a scalar field sampled at texel centres (value(i, j) for
texel (i, j), centre at (i + 0.5, j + 0.5)), at
threshold, as closed rings in texel coordinates. Outside the grid the field is 0, so every contour closes. Linear interpolation along cell edges matches bilinear texture filtering at the threshold crossing. - xml_
escape - Escape text for XML attribute values.