pub struct Canvas { /* private fields */ }
Expand description
A lightweight abstract terminal. All components in Zi ultimately draw to a
Canvas
, typically via their child components or directly in the case of
lower level components.
Implementations
sourceimpl Canvas
impl Canvas
sourcepub fn new(size: Size) -> Self
pub fn new(size: Size) -> Self
A lightweight abstract terminal. All components in Zi ultimately draw to a
Canvas
, typically via their child components or directly in the case of
lower level components.
let canvas = Canvas::new(Size::new(10, 20));
pub fn size(&self) -> Size
pub fn buffer(&self) -> &[Option<Textel>]
pub fn buffer_mut(&mut self) -> &mut [Option<Textel>]
pub fn resize(&mut self, size: Size)
pub fn clear_region(&mut self, region: Rect, style: Style)
pub fn clear(&mut self, style: Style)
pub fn clear_with(&mut self, style: Style, content: &str)
pub fn draw_str(
&mut self,
x: usize,
y: usize,
style: Style,
text: &str
) -> usize
pub fn draw_graphemes(
&mut self,
x: usize,
y: usize,
style: Style,
graphemes: impl Iterator<Item = impl Into<GraphemeCluster>>
) -> usize
pub fn copy_region(&mut self, source: &Self, region: Rect)
pub fn textel(&self, x: usize, y: usize) -> &Option<Textel>
pub fn textel_mut(&mut self, x: usize, y: usize) -> &mut Option<Textel>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Canvas
impl Send for Canvas
impl Sync for Canvas
impl Unpin for Canvas
impl UnwindSafe for Canvas
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more