[][src]Struct rumatui_tui::widgets::canvas::Painter

pub struct Painter<'a, 'b> { /* fields omitted */ }

Implementations

impl<'a, 'b> Painter<'a, 'b>[src]

pub fn get_point(&self, x: f64, y: f64) -> Option<(usize, usize)>[src]

Convert the (x, y) coordinates to location of a braille dot on the grid

Examples:

use rumatui_tui::widgets::canvas::{Painter, Context};

let mut ctx = Context::new(2, 2, [1.0, 2.0], [0.0, 2.0]);
let mut painter = Painter::from(&mut ctx);
let point = painter.get_point(1.0, 0.0);
assert_eq!(point, Some((0, 7)));
let point = painter.get_point(1.5, 1.0);
assert_eq!(point, Some((1, 3)));
let point = painter.get_point(0.0, 0.0);
assert_eq!(point, None);
let point = painter.get_point(2.0, 2.0);
assert_eq!(point, Some((3, 0)));
let point = painter.get_point(1.0, 2.0);
assert_eq!(point, Some((0, 0)));

pub fn paint(&mut self, x: usize, y: usize, color: Color)[src]

Paint a braille dot

Examples:

use rumatui_tui::{style::Color, widgets::canvas::{Painter, Context}};

let mut ctx = Context::new(1, 1, [0.0, 2.0], [0.0, 2.0]);
let mut painter = Painter::from(&mut ctx);
let cell = painter.paint(1, 3, Color::Red);

Trait Implementations

impl<'a, 'b> Debug for Painter<'a, 'b>[src]

impl<'a, 'b> From<&'a mut Context<'b>> for Painter<'a, 'b>[src]

Auto Trait Implementations

impl<'a, 'b> RefUnwindSafe for Painter<'a, 'b>

impl<'a, 'b> Send for Painter<'a, 'b>

impl<'a, 'b> Sync for Painter<'a, 'b>

impl<'a, 'b> Unpin for Painter<'a, 'b> where
    'b: 'a, 

impl<'a, 'b> !UnwindSafe for Painter<'a, 'b>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.