diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-02-13 19:28:32 +0800 |
---|---|---|
committer | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-02-13 19:28:32 +0800 |
commit | 4c18492640cebcef566d95370598d239de556e3e (patch) | |
tree | 0c4ab375c201751c8da3c2527101917f382cdd3d | |
parent | 5423bf58a5072f9b1f9667f8715801e834bdb2ef (diff) |
Use line properties rather than specific character
-rw-r--r-- | svgbob/examples/demo.rs | 2 | ||||
-rw-r--r-- | svgbob/src/map/ascii_map.rs | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/svgbob/examples/demo.rs b/svgbob/examples/demo.rs index 5c8a8b8..4057b7a 100644 --- a/svgbob/examples/demo.rs +++ b/svgbob/examples/demo.rs @@ -6,7 +6,7 @@ fn main() -> io::Result<()> { let art = include_str!("../test_data/demo.bob"); let t1 = Instant::now(); fs::create_dir_all("out")?; - fs::write("out/demo.svg", svgbob::to_svg(art))?; + fs::write("out/demo1.svg", svgbob::to_svg(art))?; println!("took {}ms", t1.elapsed().as_millis()); Ok(()) } diff --git a/svgbob/src/map/ascii_map.rs b/svgbob/src/map/ascii_map.rs index e82445c..6576ce4 100644 --- a/svgbob/src/map/ascii_map.rs +++ b/svgbob/src/map/ascii_map.rs @@ -158,15 +158,15 @@ lazy_static! { // here // | // / - (bottom_left.is('/'), vec![line(c,m),line(m,u)]), + (bottom_left.line_overlap(e,u), vec![line(c,m),line(m,u)]), // TODO: restrict left, right, bottom, top_left, top_right // | // \ - (bottom_right.is('\\'), vec![line(c,m), line(m,y)]), + (bottom_right.line_overlap(a,y), vec![line(c,m), line(m,y)]), // TODO: restrict left, right, top, bottom_left, bottom_right // \ / // | - (top_left.is('\\') && top_right.is('/'), vec![line(a,m),line(m,w),line(m,e)]), + (top_left.line_overlap(a,y) && top_right.line_overlap(e,u), vec![line(a,m),line(m,w),line(m,e)]), ] } ) @@ -448,26 +448,26 @@ lazy_static! { (right.is('\'') && bottom_left.is('\''),vec![broken_line(cell.right().c(), cell.bottom_left().c())]), // '. `. // \ \ - ((left.is('\'')||left.is('`')) && bottom_right.is('\\'),vec![arc(y, cell.left().a(), unit8 * 2.0)]), + ((left.is('\'')||left.is('`')) && bottom_right.line_overlap(a,m),vec![arc(y, cell.left().a(), unit8 * 2.0)]), // .' // / - (right.is('\'') && bottom_left.is('/'), vec![arc(cell.right().e(), u, unit8 * 2.0)]), + (right.is('\'') && bottom_left.line_overlap(e,m), vec![arc(cell.right().e(), u, unit8 * 2.0)]), // TODO: restrict left, right, bottom, top_right, is not connecting to here // | // . // / - (top.is('|') && bottom_left.is('/'), vec![arc(q,h,unit8), line(c,h), line(q,u)]), + (top.line_overlap(m,w) && bottom_left.line_overlap(e,m), vec![arc(q,h,unit8), line(c,h), line(q,u)]), // TODO: restrict left, right, bottom,top, is not connecting to here // / // . // / - (top_right.is('/') && bottom_left.is('/'), vec![line(u,e)]), + (top_right.line_overlap(m,u) && bottom_left.line_overlap(e,m), vec![line(u,e)]), // TODO: restrict left, right, bottom, top_left, does not connect to // here // | // . // \ - (top.is('|') && bottom_right.is('\\'), vec![line(c,h), arc(h,s,unit8), line(s,y)]), + (top.line_overlap(m,w) && bottom_right.line_overlap(a,m), vec![line(c,h), arc(h,s,unit8), line(s,y)]), ]} ) ), @@ -695,7 +695,7 @@ lazy_static! { // \ // | - (bottom.is('|'), vec![line(a,m),line(m,w)]), + (bottom.line_overlap(c,m), vec![line(a,m),line(m,w)]), ] } ) |