pub struct BlockCanvas { /* private fields */ }Expand description
A 2x2 pixel-per-character canvas using Unicode block elements.
Implementations§
Source§impl BlockCanvas
impl BlockCanvas
Sourcepub fn new(
char_width: usize,
char_height: usize,
origin_x: f64,
origin_y: f64,
plot_width: f64,
plot_height: f64,
) -> Self
pub fn new( char_width: usize, char_height: usize, origin_x: f64, origin_y: f64, plot_width: f64, plot_height: f64, ) -> Self
Creates a block canvas with identity axis scales.
§Panics
Panics when either axis transform cannot be constructed. This occurs if plot spans are non-positive, pixel dimensions are zero, or origins are non-finite.
Trait Implementations§
Source§impl Canvas for BlockCanvas
impl Canvas for BlockCanvas
Source§fn pixel(&mut self, x: usize, y: usize, color: CanvasColor)
fn pixel(&mut self, x: usize, y: usize, color: CanvasColor)
Sets a single pixel at the given pixel coordinates.
Source§fn glyph_at(&self, col: usize, row: usize) -> char
fn glyph_at(&self, col: usize, row: usize) -> char
Returns the Unicode glyph for the character cell at
(col, row).Source§fn color_at(&self, col: usize, row: usize) -> CanvasColor
fn color_at(&self, col: usize, row: usize) -> CanvasColor
Returns the composited color for the character cell at
(col, row).Source§fn char_width(&self) -> usize
fn char_width(&self) -> usize
The number of character columns in this canvas.
Source§fn char_height(&self) -> usize
fn char_height(&self) -> usize
The number of character rows in this canvas.
Source§fn pixel_width(&self) -> usize
fn pixel_width(&self) -> usize
The total pixel width (character columns times pixels per character).
Source§fn pixel_height(&self) -> usize
fn pixel_height(&self) -> usize
The total pixel height (character rows times pixels per character).
Source§fn transform(&self) -> &Transform2D
fn transform(&self) -> &Transform2D
Returns a reference to this canvas’s coordinate transform.
Source§fn transform_mut(&mut self) -> &mut Transform2D
fn transform_mut(&mut self) -> &mut Transform2D
Returns a mutable reference to this canvas’s coordinate transform.
Source§fn point(&mut self, x: f64, y: f64, color: CanvasColor)
fn point(&mut self, x: f64, y: f64, color: CanvasColor)
Plots a single data-space point, transforming it to pixel coordinates.
Source§fn points(&mut self, xs: &[f64], ys: &[f64], color: CanvasColor)
fn points(&mut self, xs: &[f64], ys: &[f64], color: CanvasColor)
Plots multiple data-space points. Silently ignores mismatched lengths.
Source§fn line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, color: CanvasColor)
fn line(&mut self, x1: f64, y1: f64, x2: f64, y2: f64, color: CanvasColor)
Draws a line between two data-space points using DDA rasterization.
Source§impl Clone for BlockCanvas
impl Clone for BlockCanvas
Source§fn clone(&self) -> BlockCanvas
fn clone(&self) -> BlockCanvas
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BlockCanvas
impl Debug for BlockCanvas
Source§impl PartialEq for BlockCanvas
impl PartialEq for BlockCanvas
impl StructuralPartialEq for BlockCanvas
Auto Trait Implementations§
impl Freeze for BlockCanvas
impl RefUnwindSafe for BlockCanvas
impl Send for BlockCanvas
impl Sync for BlockCanvas
impl Unpin for BlockCanvas
impl UnsafeUnpin for BlockCanvas
impl UnwindSafe for BlockCanvas
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C> GraphicsArea for Cwhere
C: Canvas,
impl<C> GraphicsArea for Cwhere
C: Canvas,
Source§fn render_row(&self, row: usize, out: &mut Vec<RowCell>)
fn render_row(&self, row: usize, out: &mut Vec<RowCell>)
Fills
out with the cells for the given row index.Source§fn blank_char(&self) -> char
fn blank_char(&self) -> char
The blank character used to fill empty cells (default: space).
Source§fn prepare_render(&mut self)
fn prepare_render(&mut self)
Called before rendering begins. Override for pre-render setup.
Source§fn finish_render(&mut self)
fn finish_render(&mut self)
Called after rendering completes. Override for post-render cleanup.