pub struct DensityCanvas { /* private fields */ }Expand description
A 1x2 pixel-per-character canvas that counts hits per cell and renders
density using shade block characters (░▒▓█).
Implementations§
Source§impl DensityCanvas
impl DensityCanvas
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 density 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 DensityCanvas
impl Canvas for DensityCanvas
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 DensityCanvas
impl Clone for DensityCanvas
Source§fn clone(&self) -> DensityCanvas
fn clone(&self) -> DensityCanvas
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 DensityCanvas
impl Debug for DensityCanvas
Source§impl PartialEq for DensityCanvas
impl PartialEq for DensityCanvas
impl StructuralPartialEq for DensityCanvas
Auto Trait Implementations§
impl Freeze for DensityCanvas
impl RefUnwindSafe for DensityCanvas
impl Send for DensityCanvas
impl Sync for DensityCanvas
impl Unpin for DensityCanvas
impl UnsafeUnpin for DensityCanvas
impl UnwindSafe for DensityCanvas
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.