pub struct Frame { /* private fields */ }Expand description
A single frame of 3a art, consisting of a grid of cells.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn to_svg_frame_bg(
&self,
palette: &Palette,
map: &CSSColorMap,
font: &Font,
) -> String
pub fn to_svg_frame_bg( &self, palette: &Palette, map: &CSSColorMap, font: &Font, ) -> String
Generates SVG background rectangles for colored cells.
Sourcepub fn to_svg_frame_txt_fg(
&self,
palette: &Palette,
map: &CSSColorMap,
font: &Font,
) -> String
pub fn to_svg_frame_txt_fg( &self, palette: &Palette, map: &CSSColorMap, font: &Font, ) -> String
Generates SVG text with foreground colors.
Sourcepub fn to_svg_frame_txt(&self, font: &Font) -> String
pub fn to_svg_frame_txt(&self, font: &Font) -> String
Generates SVG text without colors.
Sourcepub fn to_svg_frame(
&self,
colors: bool,
palette: &Palette,
map: &CSSColorMap,
font: &Font,
) -> String
pub fn to_svg_frame( &self, colors: bool, palette: &Palette, map: &CSSColorMap, font: &Font, ) -> String
Generates SVG for this frame, optionally with colors.
Source§impl Frame
impl Frame
Source§impl Frame
impl Frame
pub fn remove_color(&mut self, color: Char)
Sourcepub fn shift_right(&mut self, cols: usize, fill: Cell)
pub fn shift_right(&mut self, cols: usize, fill: Cell)
Shifts all rows right by cols, filling new cells with fill.
Sourcepub fn shift_left(&mut self, cols: usize, fill: Cell)
pub fn shift_left(&mut self, cols: usize, fill: Cell)
Shifts all rows left by cols, filling vacated cells with fill.
Sourcepub fn shift_down(&mut self, rows: usize, fill: Cell)
pub fn shift_down(&mut self, rows: usize, fill: Cell)
Shifts all columns down by rows, filling new cells with fill.
Sourcepub fn shift_up(&mut self, rows: usize, fill: Cell)
pub fn shift_up(&mut self, rows: usize, fill: Cell)
Shifts all columns up by rows, filling vacated cells with fill.
Sourcepub fn fill_area<C, R>(&mut self, columns: C, rows: R, new: Cell)
pub fn fill_area<C, R>(&mut self, columns: C, rows: R, new: Cell)
Fills a rectangular area defined by column and row iterators with new cell.
Sourcepub fn set(&mut self, column: usize, row: usize, new: Cell)
pub fn set(&mut self, column: usize, row: usize, new: Cell)
Sets the cell at (column, row) to new.
Sourcepub fn get(&self, column: usize, row: usize, default: Cell) -> Cell
pub fn get(&self, column: usize, row: usize, default: Cell) -> Cell
Gets the cell at (column, row), returning default if out of bounds.
Sourcepub fn adjust(&mut self, width: usize, height: usize, fill: Cell)
pub fn adjust(&mut self, width: usize, height: usize, fill: Cell)
Adjusts frame size to at least width and height, filling new cells with fill.
Sourcepub fn adjust_width(&mut self, width: usize, fill: Cell)
pub fn adjust_width(&mut self, width: usize, fill: Cell)
Adjusts frame width to at least width.
Sourcepub fn adjust_height(&mut self, height: usize, fill: Cell)
pub fn adjust_height(&mut self, height: usize, fill: Cell)
Adjusts frame height to at least height.
Sourcepub fn resize(&mut self, width: usize, height: usize, fill: Cell)
pub fn resize(&mut self, width: usize, height: usize, fill: Cell)
Resizes frame to exact width and height, filling new cells with fill.
Sourcepub fn resize_width(&mut self, width: usize, fill: Cell)
pub fn resize_width(&mut self, width: usize, fill: Cell)
Resizes width to exact width.
Sourcepub fn resize_height(&mut self, height: usize, fill: Cell)
pub fn resize_height(&mut self, height: usize, fill: Cell)
Resizes height to exact height.
Sourcepub fn contains_text(&self, ch: Char) -> bool
pub fn contains_text(&self, ch: Char) -> bool
Checks if the frame contains the given text character.
Sourcepub fn contains_color(&self, col: Char) -> bool
pub fn contains_color(&self, col: Char) -> bool
Checks if the frame contains the given color character.
Sourcepub fn fill_color(&mut self, fill: Option<Char>)
pub fn fill_color(&mut self, fill: Option<Char>)
Fills all color cells with the given character (or None).
Sourcepub fn print(
&mut self,
col: usize,
row: usize,
line: &str,
color: Option<Option<Char>>,
)
pub fn print( &mut self, col: usize, row: usize, line: &str, color: Option<Option<Char>>, )
Prints text to frame.
Sourcepub fn ansi(&self, palette: &Palette, color: bool) -> String
pub fn ansi(&self, palette: &Palette, color: bool) -> String
Renders the frame as ANSI escape sequences.
Sourcepub fn new(width: usize, height: usize, fill: Cell) -> Self
pub fn new(width: usize, height: usize, fill: Cell) -> Self
Creates a new frame of given dimensions filled with fill.
Sourcepub fn fmt_colors(&self, f: &mut Formatter<'_>) -> Result
pub fn fmt_colors(&self, f: &mut Formatter<'_>) -> Result
Formats the frame’s color channel.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.