pub struct Canvas { /* private fields */ }
Expand description

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).

Implementations§

source§

impl Canvas

source

pub fn foreground(self, fg: Color) -> Self

source

pub fn background(self, bg: Color) -> Self

source

pub fn borders(self, b: Borders) -> Self

source

pub fn title<S: AsRef<str>>(self, t: S, a: Alignment) -> Self

source

pub fn data(self, data: &[Shape]) -> Self

source

pub fn x_bounds(self, bounds: (f64, f64)) -> Self

From https://github.com/fdehau/tui-rs/issues/286:

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.

source

pub fn y_bounds(self, bounds: (f64, f64)) -> Self

From https://github.com/fdehau/tui-rs/issues/286:

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.

source

pub fn marker(self, marker: Marker) -> Self

Set marker to use to draw on canvas

Trait Implementations§

source§

impl Default for Canvas

source§

fn default() -> Canvas

Returns the “default value” for a type. Read more
source§

impl MockComponent for Canvas

source§

fn view(&mut self, render: &mut Frame<'_>, area: Rect)

Based on the current properties and states, renders the component in the provided area frame. Render can also mutate the component state if this is required
source§

fn query(&self, attr: Attribute) -> Option<AttrValue>

Query attribute of component properties.
source§

fn attr(&mut self, attr: Attribute, value: AttrValue)

Set attribute to properties. query describes the name, while attr the value it’ll take
source§

fn state(&self) -> State

Get current state from component
source§

fn perform(&mut self, _cmd: Cmd) -> CmdResult

Perform a command on the component. The command will may change the component state. The method returns the result of the command applied (what changed if any)

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.