wmap-renderer
A rust renderer for wmap formatted wardley maps parsed with [wmap-parser][wmap-parser-rust].
Features
- Can render to PNG or SVG.
- Rendering logic attempts to replicate [map][map]'s output.
Installation
Add it to your project with cargo add
Usage
use ;
let map_source = r#"
Computer (90, 20)
Silicon Ore (80, 90)
Computer -> Silicon Ore
"#;
let map = parse;
let config = default;
// Render to PNG
let png_data = render_to_png?;
write?;
// Render to SVG
let svg_data = render_to_svg?;
write?;
Configuration
The renderer lets you configure sizes, colors, and font.
let mut config = default;
config.theme.colors.vertex = "#FF0000".to_string;
config.theme.sizes.vertex_size = 30.0;
config.options.show_background = false;
Development
Running Examples
Running Tests
Performance
The drawing is not optimized for live-editing. It's relatively quick to generate a single image. On an M1 Pro mac, our xample map renders in about ~2ms, while a larger map with slightly under 2000 entities does so in ~140ms.
Turning off smart labels doesn't have a big effect on medium to small maps, but in our large map test it renders in ~97ms instead.
You can run the benchmarks by using: