cursive-image 0.0.6

Image view for the Cursive TUI library
Documentation
use {
    cursive::{views::*, *},
    cursive_image::*,
};

// (note that rendering SVG is slow for dev builds)
const FILE: &str = "assets/media/chart.svg";

fn main() {
    let mut cursive = default();

    cursive.add_layer(Panel::new(ImageView::default().with_image(
        // SVG can be either PNG or RGBA (PNG is usually more efficient)
        // Note that we can apply scaling during rendering
        Image::new_stream_from_svg_file(FILE, ImageFormat::PNG, 2.5).expect("new_stream_from_svg_file"),
    )));

    cursive.add_global_callback('q', |cursive| cursive.quit());

    cursive.run();
}