svg/svg.rs
1use {
2 cursive::{views::*, *},
3 cursive_image::*,
4};
5
6// (note that rendering SVG is slow for dev builds)
7const FILE: &str = "assets/media/chart.svg";
8
9fn main() {
10 let mut cursive = default();
11
12 cursive.add_layer(Panel::new(ImageView::default().with_image(
13 // SVG can be either PNG or RGBA (PNG is usually more efficient)
14 // Note that we can apply scaling during rendering
15 Image::new_stream_from_svg_file(FILE, ImageFormat::PNG, 2.5).expect("new_stream_from_svg_file"),
16 )));
17
18 cursive.add_global_callback('q', |cursive| cursive.quit());
19
20 cursive.run();
21}