Struct tui::widgets::canvas::Canvas[][src]

pub struct Canvas<'a, F> where
    F: Fn(&mut Context), 
{ /* fields omitted */ }

The Canvas widget may be used to draw more detailed figures using braille patterns (each cell can have a braille character in 8 different positions).

Examples

Canvas::default()
    .block(Block::default().title("Canvas").borders(Borders::ALL))
    .x_bounds([-180.0, 180.0])
    .y_bounds([-90.0, 90.0])
    .paint(|ctx| {
        ctx.draw(&Map{
            resolution: MapResolution::High,
            color: Color::White
        });
        ctx.layer();
        ctx.draw(&Line{
            x1: 0.0,
            y1: 10.0,
            x2: 10.0,
            y2: 10.0,
            color: Color::White,
        });
        ctx.draw(&Line{
            x1: 10.0,
            y1: 10.0,
            x2: 20.0,
            y2: 20.0,
            color: Color::Red
        });
    });

Methods

impl<'a, F> Canvas<'a, F> where
    F: Fn(&mut Context), 
[src]

Store the closure that will be used to draw to the Canvas

Trait Implementations

impl<'a, F> Default for Canvas<'a, F> where
    F: Fn(&mut Context), 
[src]

Returns the "default value" for a type. Read more

impl<'a, F> Widget for Canvas<'a, F> where
    F: Fn(&mut Context), 
[src]

Draws the current state of the widget in the given buffer. That the only method required to implement a custom widget. Read more

Helper method to quickly set the background of all cells inside the specified area.

Helper method that can be chained with a widget's builder methods to render it.

Auto Trait Implementations

impl<'a, F> Send for Canvas<'a, F> where
    F: Send

impl<'a, F> Sync for Canvas<'a, F> where
    F: Sync