Expand description
Text rasterizer for Text clips: system fonts (fontdb) + ab_glyph. Produces a tight, straight-alpha
RGBA image with fill, outline (dilated coverage), shadow (offset + box blur) and optional background box.
Output is cached by (style.cache_key(), scale bits). scale = canvas px per project px, so a 72 px
style at a 960-wide preview of a 1920 project renders at 36 px.
Structs§
Constants§
- MAX_
SIDE 🔒 - Largest rendered text image side — keeps silly sizes from allocating gigabytes.
Functions§
- blur_
lines 🔒 - 1-D box blur of
lineslines oflenelements; element j of line i is at ilstride + jestride. - box_
blur 🔒 - Two iterations of a separable box blur with radius
r(≈ Gaussian of radius 2r). - dilate 🔒
- Disc dilation of a coverage mask by radius
r(antialiased rim): exact Euclidean distance transform (Felzenszwalb–Huttenlocher, columns then rows), O(px) whatever the radius. - dt1d 🔒
- 1-D squared-distance transform of sampled function
fintod(lower envelope of parabolas).v/zare scratch of len ≥ f.len() / f.len()+1. - over 🔒
- Straight-alpha “over”:
cwith coveragecov(0..255) onto the straight-alpha pixeld.