pub struct Canvas { /* private fields */ }Expand description
A row-major grid of cells that generators draw into.
Implementations§
Source§impl Canvas
impl Canvas
pub fn new(size: Size, mode: GlyphMode) -> Self
pub fn size(&self) -> Size
pub fn mode(&self) -> GlyphMode
pub fn set_mode(&mut self, mode: GlyphMode)
pub fn cells(&self) -> &[Cell]
Sourcepub fn resize(&mut self, size: Size)
pub fn resize(&mut self, size: Size)
Reallocate only when the size actually changes; always leaves a blank canvas (CORE-R5).
pub fn clear(&mut self)
pub fn get(&self, x: i32, y: i32) -> Option<&Cell>
Sourcepub fn put(&mut self, x: i32, y: i32, glyph: Glyph, ink: Ink)
pub fn put(&mut self, x: i32, y: i32, glyph: Glyph, ink: Ink)
Draw one glyph; out-of-bounds coordinates are ignored (CORE-R3, CORE-R4).
Clears the cell’s background, so overdrawing a half-block pixel never leaves a stale background colour behind (CORE-R40).
Sourcepub fn put_bg(&mut self, x: i32, y: i32, glyph: Glyph, fg: Ink, bg: Ink)
pub fn put_bg(&mut self, x: i32, y: i32, glyph: Glyph, fg: Ink, bg: Ink)
Draw one glyph with a foreground and a background ink, under the same bounds
and glyph-mode rules as put (CORE-R40).
Trait Implementations§
Auto Trait Implementations§
impl Forget for Canvas
impl Freeze for Canvas
impl Move 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
Mutably borrows from an owned value. Read more