[−][src]Struct tui::widgets::canvas::Canvas
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(&Rectangle { rect: Rect { x: 10, y: 20, width: 10, height: 10, }, color: Color::Red }); });
Methods
impl<'a, F> Canvas<'a, F> where
F: Fn(&mut Context),
[src]
F: Fn(&mut Context),
pub fn block(self, block: Block<'a>) -> Canvas<'a, F>
[src]
pub fn x_bounds(self, bounds: [f64; 2]) -> Canvas<'a, F>
[src]
pub fn y_bounds(self, bounds: [f64; 2]) -> Canvas<'a, F>
[src]
pub fn paint(self, f: F) -> Canvas<'a, F>
[src]
Store the closure that will be used to draw to the Canvas
pub fn background_color(self, color: Color) -> Canvas<'a, F>
[src]
Trait Implementations
impl<'a, F> Widget for Canvas<'a, F> where
F: Fn(&mut Context),
[src]
F: Fn(&mut Context),
fn draw(&mut self, area: Rect, buf: &mut Buffer)
[src]
fn background(&self, area: Rect, buf: &mut Buffer, color: Color)
[src]
Helper method to quickly set the background of all cells inside the specified area.
fn render<B>(&mut self, f: &mut Frame<B>, area: Rect) where
Self: Sized,
B: Backend,
[src]
Self: Sized,
B: Backend,
Helper method that can be chained with a widget's builder methods to render it.
impl<'a, F> Default for Canvas<'a, F> where
F: Fn(&mut Context),
[src]
F: Fn(&mut Context),
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,