1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#![deny(warnings)]
#![allow(unused)]
#![deny(clippy::all)]
pub mod buffer;
mod map;
mod point;
pub mod util;
pub use buffer::{
fragment, fragment::Fragment, Cell, CellBuffer, Direction, FragmentBuffer, Property, Settings,
Signal,
};
pub use point::Point;
pub use sauron;
pub use sauron::{Node, Render};
/// convert svgbob ascii art to svg
pub fn to_svg(ascii: &str) -> String {
let cb = CellBuffer::from(ascii);
let node: Node<()> = cb.get_node();
let mut buffer = String::new();
node.render(&mut buffer).expect("must render");
buffer
}
/// convert ascii art into an svg
pub fn to_svg_with_settings(ascii: &str, settings: &Settings) -> String {
let cb = CellBuffer::from(ascii);
let (node, _w, _h): (Node<()>, f32, f32) = cb.get_node_with_size(settings);
let mut buffer = String::new();
node.render(&mut buffer).expect("must render");
buffer
}
|