Vector icons#
Source: lib/ui/vicon.rs
vicon -- vector icons from SVG path data, for styles (Style::paint_icon) and app icon hooks
paint_svg_icon(g, art, x, y, size_fx, color, stroke) -> drawn
art: SVG path data on a 24 x 24 grid; several layers are separated by '|', a layer
that starts with 'F' is filled (non-zero rule), the others are stroked with round
caps and joins `stroke` grid units wide (1.75 is a good outline weight); 'E' fills
with the even-odd rule (cut-outs: a mark inside a filled disc). The icon's
em box has its top-left corner at (x, y) target pixels and is size_fx (24.8) pixels
square. A layer that starts with 'A' is drawn in the accent colour (second colour).
paint_svg_icon2(.., color, accent, stroke) the same with an accent colour for 'A' layers
Icons are geometry, not font glyphs: crisp at every size and dpi, and free of the icon
font's licence. Parsing is cheap (a few dozen commands per icon).
The layer prefix (layer_head, shared with symbol.rs): 'A', 'F', 'E', '#n' (a palette role
of a multi-colour symbol, ignored here) and 'S<w>' (this layer's stroke width in grid
units instead of `stroke`) in any order before the first path command.
fn paint_svg_icon(g: &mut Gfx, art: &str, x: i32, y: i32, size_fx: i32, color: u32, stroke: f32) -> boolpaint an icon from 24-grid SVG path data (see the module comment)fn paint_svg_icon2(g: &mut Gfx, art: &str, x: i32, y: i32, size_fx: i32, color: u32, accent: u32, stroke: f32) -> boolpaint_svg_icon with a second (accent) colour for the layers that start with 'A'