zhc_ir 0.7.0

Graph-based intermediate representation framework with dialect support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::syntax_tree::*;

use crate::visualization::composition::SceneElement;

/// Renders a scene graph element to SVG.
pub fn draw(scene: &impl Renderable) -> Svg {
    let frame = scene.get_frame();
    Svg {
        width: frame.size.width.0.0,
        height: frame.size.height.0.0,
        elements: scene.render(),
    }
}

/// Trait for scene graph elements that can render to SVG.
pub trait Renderable: SceneElement {
    fn render(&self) -> Vec<SvgElement>;
}