pub struct Canvas { /* private fields */ }Expand description
The Canvas component may be used to draw more detailed figures using braille patterns (each cell can have a braille character in 8 different positions).
Implementations§
Source§impl Canvas
impl Canvas
Sourcepub fn foreground(self, fg: Color) -> Self
pub fn foreground(self, fg: Color) -> Self
Note that setting this value has no effect.
If you want to set the border color, use borders.
If you want to set some point in the canvas, set it in the data.
Sourcepub fn background(self, bg: Color) -> Self
pub fn background(self, bg: Color) -> Self
Set the main background color. This may get overwritten by individual text styles.
Sourcepub fn modifiers(self, m: TextModifiers) -> Self
pub fn modifiers(self, m: TextModifiers) -> Self
Set the main text modifiers. This may get overwritten by individual text styles.
Sourcepub fn style(self, style: Style) -> Self
pub fn style(self, style: Style) -> Self
Set the main style. This may get overwritten by individual text styles.
This option will overwrite any previous foreground, background and modifiers!
Sourcepub fn inactive(self, s: Style) -> Self
pub fn inactive(self, s: Style) -> Self
Set a custom style for the border when the component is unfocused.
Sourcepub fn data(self, data: impl IntoIterator<Item = Shape>) -> Self
pub fn data(self, data: impl IntoIterator<Item = Shape>) -> Self
Set the initial data to display on the Canvas.
Sourcepub fn x_bounds(self, bounds: (f64, f64)) -> Self
pub fn x_bounds(self, bounds: (f64, f64)) -> Self
Those are used to define the viewport of the canvas. Only the points whose coordinates are within the viewport are displayed. When you render the canvas using Frame::render_widget, you give an area to draw the widget to (a Rect) and the crate translates the floating point coordinates to those used by our internal terminal representation.
From https://github.com/fdehau/tui-rs/issues/286, also read Canvas::x_bounds.
Sourcepub fn y_bounds(self, bounds: (f64, f64)) -> Self
pub fn y_bounds(self, bounds: (f64, f64)) -> Self
Those are used to define the viewport of the canvas. Only the points whose coordinates are within the viewport are displayed. When you render the canvas using Frame::render_widget, you give an area to draw the widget to (a Rect) and the crate translates the floating point coordinates to those used by our internal terminal representation.
From https://github.com/fdehau/tui-rs/issues/286, also read Canvas::y_bounds.
Trait Implementations§
Source§impl Component for Canvas
impl Component for Canvas
Source§fn view(&mut self, render: &mut Frame<'_>, area: Rect)
fn view(&mut self, render: &mut Frame<'_>, area: Rect)
Source§fn query<'a>(&'a self, attr: Attribute) -> Option<QueryResult<'a>>
fn query<'a>(&'a self, attr: Attribute) -> Option<QueryResult<'a>>
Auto Trait Implementations§
impl Freeze for Canvas
impl !RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnsafeUnpin for Canvas
impl !UnwindSafe for Canvas
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more