pub struct VgaWriter {Show 24 fields
pub(crate) enabled: bool,
pub(crate) canvas: Option<CanvasBuffer>,
pub(crate) fmt: PixelFormat,
pub(crate) cols: usize,
pub(crate) rows: usize,
pub(crate) col: usize,
pub(crate) row: usize,
pub(crate) fg: u32,
pub(crate) bg: u32,
pub(crate) font: &'static [u8],
pub(crate) font_info: FontInfo,
pub(crate) glyph_mask_cache: Vec<u8>,
pub(crate) unicode_map: Vec<(u32, usize)>,
pub(crate) status_bar_height: usize,
pub(crate) clip: ClipRect,
pub(crate) sb: ScrollbackBuffer,
pub(crate) scroll_offset: usize,
pub(crate) cursor: CursorManager,
pub(crate) sel_active: bool,
pub(crate) sel_start_row: usize,
pub(crate) sel_start_col: usize,
pub(crate) sel_end_row: usize,
pub(crate) sel_end_col: usize,
pub(crate) prepared_row_cells: Vec<(usize, u32, u32)>,
}Fields§
§enabled: bool§canvas: Option<CanvasBuffer>Shared double-buffered framebuffer canvas (None before init).
fmt: PixelFormatPixel format (pack_rgb/unpack_color helpers).
cols: usize§rows: usize§col: usize§row: usize§fg: u32§bg: u32§font: &'static [u8]§font_info: FontInfo§glyph_mask_cache: Vec<u8>§unicode_map: Vec<(u32, usize)>§status_bar_height: usize§clip: ClipRect§sb: ScrollbackBufferScrollback ring-buffer.
scroll_offset: usize§cursor: CursorManagerMouse + text cursor manager.
sel_active: bool§sel_start_row: usize§sel_start_col: usize§sel_end_row: usize§sel_end_col: usize§prepared_row_cells: Vec<(usize, u32, u32)>Implementations§
Source§impl VgaWriter
Short helpers to access the optional canvas without repeating unwrap.
impl VgaWriter
Short helpers to access the optional canvas without repeating unwrap.
fn can(&self) -> &CanvasBuffer
fn canm(&mut self) -> &mut CanvasBuffer
Source§impl VgaWriter
impl VgaWriter
Sourcepub(crate) fn sb_capacity(&self) -> usize
pub(crate) fn sb_capacity(&self) -> usize
Maximum capacity of the scrollback ring buffer.
pub(crate) fn sb_row_at(&self, logical_idx: usize) -> Option<&Vec<SbCell>>
pub(crate) fn sb_push_row(&mut self, row: Vec<SbCell>)
pub(crate) fn build_glyph_mask_cache( font: &'static [u8], info: &FontInfo, ) -> Vec<u8>
pub(crate) fn glyph_mask_slice(&self, glyph_index: usize) -> Option<&[u8]>
Sourcepub(crate) fn configure(
&mut self,
fb_addr: *mut u8,
fb_width: usize,
fb_height: usize,
pitch: usize,
fmt: PixelFormat,
) -> bool
pub(crate) fn configure( &mut self, fb_addr: *mut u8, fb_width: usize, fb_height: usize, pitch: usize, fmt: PixelFormat, ) -> bool
Performs the configure operation.
Sourcepub(crate) fn pack_color(&self, color: RgbColor) -> u32
pub(crate) fn pack_color(&self, color: RgbColor) -> u32
Performs the pack color operation.
Sourcepub(crate) fn unpack_color(&self, value: u32) -> RgbColor
pub(crate) fn unpack_color(&self, value: u32) -> RgbColor
Performs the unpack color operation.
Sourcepub fn set_rgb_color(&mut self, fg: RgbColor, bg: RgbColor)
pub fn set_rgb_color(&mut self, fg: RgbColor, bg: RgbColor)
Sets rgb color.
Sourcepub fn text_colors(&self) -> (RgbColor, RgbColor)
pub fn text_colors(&self) -> (RgbColor, RgbColor)
Performs the text colors operation.
Sourcepub fn glyph_size(&self) -> (usize, usize)
pub fn glyph_size(&self) -> (usize, usize)
Performs the glyph size operation.
Sourcepub fn set_cursor_cell(&mut self, col: usize, row: usize)
pub fn set_cursor_cell(&mut self, col: usize, row: usize)
Sets cursor cell.
Sourcepub(crate) fn text_area_height(&self) -> usize
pub(crate) fn text_area_height(&self) -> usize
Performs the text area height operation.
Sourcepub fn framebuffer_info(&self) -> FramebufferInfo
pub fn framebuffer_info(&self) -> FramebufferInfo
Performs the framebuffer info operation.
Sourcepub(crate) fn clipped_rect(
&self,
x: usize,
y: usize,
width: usize,
height: usize,
) -> Option<(usize, usize, usize, usize)>
pub(crate) fn clipped_rect( &self, x: usize, y: usize, width: usize, height: usize, ) -> Option<(usize, usize, usize, usize)>
Performs the clipped rect operation.
Sourcepub(crate) fn clear_dirty(&mut self)
pub(crate) fn clear_dirty(&mut self)
Performs the clear dirty operation.
Sourcepub(crate) fn mark_dirty_rect(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
)
pub(crate) fn mark_dirty_rect( &mut self, x: usize, y: usize, width: usize, height: usize, )
Performs the mark dirty rect operation.
Sourcepub fn set_clip_rect(&mut self, x: usize, y: usize, width: usize, height: usize)
pub fn set_clip_rect(&mut self, x: usize, y: usize, width: usize, height: usize)
Sets clip rect.
Sourcepub fn reset_clip_rect(&mut self)
pub fn reset_clip_rect(&mut self)
Performs the reset clip rect operation.
Sourcepub(crate) fn draw_to_back_buffer(&self) -> bool
pub(crate) fn draw_to_back_buffer(&self) -> bool
Performs the draw to back buffer operation.
Sourcepub fn enable_double_buffer(&mut self) -> bool
pub fn enable_double_buffer(&mut self) -> bool
Enables double buffer.
Sourcepub fn disable_double_buffer(&mut self, present: bool)
pub fn disable_double_buffer(&mut self, present: bool)
Disables double buffer.
pub(crate) fn request_present(&mut self)
pub(crate) fn present_if_due(&mut self, force: bool)
Sourcepub(crate) fn mc_save_hw(&mut self)
pub(crate) fn mc_save_hw(&mut self)
Performs the mc save hw operation. Uses read_pixel_packed (back-buffer aware) instead of read_hw_pixel_packed.
Sourcepub(crate) fn mc_draw_hw(&mut self)
pub(crate) fn mc_draw_hw(&mut self)
Performs the mc draw hw operation. Uses put_pixel_raw (back-buffer aware) instead of write_hw_pixel_packed.
Sourcepub(crate) fn mc_erase_hw(&mut self)
pub(crate) fn mc_erase_hw(&mut self)
Performs the mc erase hw operation. Uses put_pixel_raw (back-buffer aware) instead of write_hw_pixel_packed.
Sourcepub fn update_mouse_cursor(&mut self, x: i32, y: i32)
pub fn update_mouse_cursor(&mut self, x: i32, y: i32)
Updates mouse cursor.
Sourcepub fn hide_mouse_cursor(&mut self)
pub fn hide_mouse_cursor(&mut self)
Performs the hide mouse cursor operation.
pub(crate) fn text_cursor_rect(&self) -> Option<(usize, usize, usize, usize)>
Sourcepub(crate) fn text_cursor_save_hw(&mut self)
pub(crate) fn text_cursor_save_hw(&mut self)
Save text cursor pixels. Uses read_pixel_packed (back-buffer aware).
Sourcepub(crate) fn text_cursor_draw_hw(&mut self)
pub(crate) fn text_cursor_draw_hw(&mut self)
Draw text cursor. Uses put_pixel_raw (back-buffer aware).
Sourcepub(crate) fn text_cursor_erase_hw(&mut self)
pub(crate) fn text_cursor_erase_hw(&mut self)
Erase text cursor (restore saved pixels). Uses put_pixel_raw (back-buffer aware).
pub(crate) fn draw_text_cursor_overlay(&mut self, color: RgbColor)
Sourcepub fn hide_text_cursor(&mut self)
pub fn hide_text_cursor(&mut self)
Performs the hide text cursor operation on the writer.
Sourcepub(crate) fn sel_normalized(&self) -> (usize, usize, usize, usize)
pub(crate) fn sel_normalized(&self) -> (usize, usize, usize, usize)
Performs the sel normalized operation.
Sourcepub fn pixel_to_sb_pos(&self, px: usize, py: usize) -> Option<(usize, usize)>
pub fn pixel_to_sb_pos(&self, px: usize, py: usize) -> Option<(usize, usize)>
Performs the pixel to sb pos operation.
Sourcepub fn start_selection(&mut self, px: usize, py: usize)
pub fn start_selection(&mut self, px: usize, py: usize)
Starts selection.
Sourcepub fn update_selection(&mut self, px: usize, py: usize)
pub fn update_selection(&mut self, px: usize, py: usize)
Updates selection.
Sourcepub fn end_selection(&mut self)
pub fn end_selection(&mut self)
Performs the end selection operation.
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Performs the clear selection operation.
Sourcepub fn clear_with(&mut self, color: RgbColor)
pub fn clear_with(&mut self, color: RgbColor)
Performs the clear with operation.
Sourcepub(crate) fn pixel_offset(&self, x: usize, y: usize) -> Option<usize>
pub(crate) fn pixel_offset(&self, x: usize, y: usize) -> Option<usize>
Performs the pixel offset operation.
Sourcepub(crate) fn write_hw_pixel_packed(&mut self, x: usize, y: usize, color: u32)
pub(crate) fn write_hw_pixel_packed(&mut self, x: usize, y: usize, color: u32)
Writes hw pixel packed.
Sourcepub(crate) fn read_hw_pixel_packed(&self, x: usize, y: usize) -> u32
pub(crate) fn read_hw_pixel_packed(&self, x: usize, y: usize) -> u32
Reads hw pixel packed.
Sourcepub(crate) fn read_pixel_packed(&self, x: usize, y: usize) -> u32
pub(crate) fn read_pixel_packed(&self, x: usize, y: usize) -> u32
Reads pixel packed.
Sourcepub(crate) fn put_pixel_raw(&mut self, x: usize, y: usize, color: u32)
pub(crate) fn put_pixel_raw(&mut self, x: usize, y: usize, color: u32)
Performs the put pixel raw operation.
Sourcepub fn draw_pixel(&mut self, x: usize, y: usize, color: RgbColor)
pub fn draw_pixel(&mut self, x: usize, y: usize, color: RgbColor)
Performs the draw pixel operation.
Sourcepub fn draw_pixel_alpha(
&mut self,
x: usize,
y: usize,
color: RgbColor,
alpha: u8,
)
pub fn draw_pixel_alpha( &mut self, x: usize, y: usize, color: RgbColor, alpha: u8, )
Performs the draw pixel alpha operation.
Sourcepub fn draw_line(
&mut self,
x0: isize,
y0: isize,
x1: isize,
y1: isize,
color: RgbColor,
)
pub fn draw_line( &mut self, x0: isize, y0: isize, x1: isize, y1: isize, color: RgbColor, )
Performs the draw line operation.
Sourcepub fn draw_rect(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
color: RgbColor,
)
pub fn draw_rect( &mut self, x: usize, y: usize, width: usize, height: usize, color: RgbColor, )
Performs the draw rect operation.
Sourcepub fn fill_rect(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
color: RgbColor,
)
pub fn fill_rect( &mut self, x: usize, y: usize, width: usize, height: usize, color: RgbColor, )
Performs the fill rect operation.
Sourcepub fn fill_rect_alpha(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
color: RgbColor,
alpha: u8,
)
pub fn fill_rect_alpha( &mut self, x: usize, y: usize, width: usize, height: usize, color: RgbColor, alpha: u8, )
Performs the fill rect alpha operation.
Sourcepub fn blit_rgb(
&mut self,
dst_x: usize,
dst_y: usize,
src_width: usize,
src_height: usize,
pixels: &[RgbColor],
) -> bool
pub fn blit_rgb( &mut self, dst_x: usize, dst_y: usize, src_width: usize, src_height: usize, pixels: &[RgbColor], ) -> bool
Performs the blit rgb operation.
Sourcepub fn blit_rgb24(
&mut self,
dst_x: usize,
dst_y: usize,
src_width: usize,
src_height: usize,
bytes: &[u8],
) -> bool
pub fn blit_rgb24( &mut self, dst_x: usize, dst_y: usize, src_width: usize, src_height: usize, bytes: &[u8], ) -> bool
Performs the blit rgb24 operation.
Sourcepub fn blit_rgba(
&mut self,
dst_x: usize,
dst_y: usize,
src_width: usize,
src_height: usize,
bytes: &[u8],
global_alpha: u8,
) -> bool
pub fn blit_rgba( &mut self, dst_x: usize, dst_y: usize, src_width: usize, src_height: usize, bytes: &[u8], global_alpha: u8, ) -> bool
Performs the blit rgba operation.
Sourcepub fn blit_sprite_rgba(
&mut self,
dst_x: usize,
dst_y: usize,
sprite: SpriteRgba<'_>,
global_alpha: u8,
) -> bool
pub fn blit_sprite_rgba( &mut self, dst_x: usize, dst_y: usize, sprite: SpriteRgba<'_>, global_alpha: u8, ) -> bool
Performs the blit sprite rgba operation.
Sourcepub fn draw_text_at(
&mut self,
pixel_x: usize,
pixel_y: usize,
text: &str,
fg: RgbColor,
bg: RgbColor,
)
pub fn draw_text_at( &mut self, pixel_x: usize, pixel_y: usize, text: &str, fg: RgbColor, bg: RgbColor, )
Performs the draw text at operation.
Sourcepub(crate) fn glyph_index_for_char(&self, ch: char) -> usize
pub(crate) fn glyph_index_for_char(&self, ch: char) -> usize
Performs the glyph index for char operation.
Sourcepub(crate) fn draw_glyph_index_at_pixel(
&mut self,
pixel_x: usize,
pixel_y: usize,
glyph_index: usize,
fg: u32,
bg: u32,
)
pub(crate) fn draw_glyph_index_at_pixel( &mut self, pixel_x: usize, pixel_y: usize, glyph_index: usize, fg: u32, bg: u32, )
Performs the draw glyph index at pixel operation.
Sourcepub(crate) fn draw_glyph_at_pixel(
&mut self,
pixel_x: usize,
pixel_y: usize,
ch: char,
fg: u32,
bg: u32,
)
pub(crate) fn draw_glyph_at_pixel( &mut self, pixel_x: usize, pixel_y: usize, ch: char, fg: u32, bg: u32, )
Performs the draw glyph at pixel operation.
pub(crate) fn fill_text_span_bg( &mut self, pixel_x: usize, pixel_y: usize, width: usize, height: usize, bg: u32, )
pub(crate) fn clear_text_line_pixels(&mut self, vis_row: usize)
pub(crate) fn visible_virtual_bounds( &self, ) -> (usize, usize, usize, usize, bool)
pub(crate) fn sync_live_cursor_from_view( &mut self, total_complete: usize, view_start: usize, view_end: usize, )
pub(crate) fn selection_colors_for_cell( &self, virt_row: usize, col: usize, fg: u32, bg: u32, ) -> (u32, u32)
pub(crate) fn render_virtual_row( &mut self, virt_row: usize, vis_row: usize, total_complete: usize, has_partial: bool, )
pub(crate) fn redraw_visible_rows(&mut self, start_vis_row: usize, count: usize)
pub(crate) fn ensure_back_buffer_for_viewport(&mut self)
pub(crate) fn begin_viewport_render(&mut self) -> (bool, bool)
pub(crate) fn end_viewport_render( &mut self, prev_draw_to_back: bool, prev_track_dirty: bool, )
pub(crate) fn finalize_live_view_state(&mut self)
pub(crate) fn render_viewport_full(&mut self)
pub(crate) fn refresh_viewport_decorations(&mut self)
pub(crate) fn set_scroll_offset_and_render(&mut self, new_offset: usize)
pub(crate) fn move_text_view_pixels_up(&mut self, pixels: usize)
pub(crate) fn move_text_view_pixels_down(&mut self, pixels: usize)
Sourcepub(crate) fn layout_text_lines(
&self,
text: &str,
wrap: bool,
max_cols: Option<usize>,
) -> Vec<Vec<char>>
pub(crate) fn layout_text_lines( &self, text: &str, wrap: bool, max_cols: Option<usize>, ) -> Vec<Vec<char>>
Performs the layout text lines operation.
Sourcepub fn measure_text(
&self,
text: &str,
max_width: Option<usize>,
wrap: bool,
) -> TextMetrics
pub fn measure_text( &self, text: &str, max_width: Option<usize>, wrap: bool, ) -> TextMetrics
Performs the measure text operation.
Sourcepub fn draw_text(
&mut self,
pixel_x: usize,
pixel_y: usize,
text: &str,
opts: TextOptions,
) -> TextMetrics
pub fn draw_text( &mut self, pixel_x: usize, pixel_y: usize, text: &str, opts: TextOptions, ) -> TextMetrics
Performs the draw text operation.
Sourcepub fn draw_strata_stack(
&mut self,
origin_x: usize,
origin_y: usize,
layer_w: usize,
layer_h: usize,
)
pub fn draw_strata_stack( &mut self, origin_x: usize, origin_y: usize, layer_w: usize, layer_h: usize, )
Performs the draw strata stack operation.
Sourcepub(crate) fn draw_glyph(&mut self, cx: usize, cy: usize, ch: char)
pub(crate) fn draw_glyph(&mut self, cx: usize, cy: usize, ch: char)
Performs the draw glyph operation.
Sourcepub(crate) fn write_char(&mut self, c: char)
pub(crate) fn write_char(&mut self, c: char)
Writes char.
Sourcepub(crate) fn write_bytes(&mut self, s: &str)
pub(crate) fn write_bytes(&mut self, s: &str)
Writes bytes.
Sourcepub(crate) fn sb_mirror_char(&mut self, c: char)
pub(crate) fn sb_mirror_char(&mut self, c: char)
Mirror a normalized character into the scrollback model.
Called by write_char before any live rendering.
Mirror a typed character into the scrollback buffer.
Sourcepub(crate) fn draw_scrollbar_inner(&mut self)
pub(crate) fn draw_scrollbar_inner(&mut self)
Draw (or refresh) the scrollbar strip on the right edge of the text area.
Sourcepub(crate) fn redraw_from_scrollback(&mut self)
pub(crate) fn redraw_from_scrollback(&mut self)
Redraw the entire text area from the scrollback buffer. Called when scroll_offset changes.
pub(crate) fn redraw_from_scrollback_incremental( &mut self, old_offset: usize, ) -> bool
Sourcepub fn scroll_view_up(&mut self, lines: usize)
pub fn scroll_view_up(&mut self, lines: usize)
Scroll the view up (backward in history) by lines lines.
Sourcepub fn scroll_view_down(&mut self, lines: usize)
pub fn scroll_view_down(&mut self, lines: usize)
Scroll the view down (forward, toward live) by lines lines.
Sourcepub fn scroll_to_live(&mut self)
pub fn scroll_to_live(&mut self)
Immediately return to the live (bottom) view.
Sourcepub fn scrollbar_click(&mut self, px_x: usize, px_y: usize)
pub fn scrollbar_click(&mut self, px_x: usize, px_y: usize)
Handle a click at pixel (px_x, px_y) : if it falls in the scrollbar,
jump the view to the corresponding scroll position.
Sourcepub fn scrollbar_drag_to(&mut self, px_y: usize)
pub fn scrollbar_drag_to(&mut self, px_y: usize)
Drag the scrollbar thumb to vertical pixel px_y.
Unlike scrollbar_click, this only depends on Y and is intended for
click-and-drag interactions where the pointer may slightly leave the
scrollbar strip horizontally.
Sourcepub fn scrollbar_hit_test(&self, px_x: usize, px_y: usize) -> bool
pub fn scrollbar_hit_test(&self, px_x: usize, px_y: usize) -> bool
Returns true if the pixel coordinates fall within the scrollbar strip.
Trait Implementations§
impl Send for VgaWriter
Auto Trait Implementations§
impl !Sync for VgaWriter
impl Freeze for VgaWriter
impl RefUnwindSafe for VgaWriter
impl Unpin for VgaWriter
impl UnsafeUnpin for VgaWriter
impl UnwindSafe for VgaWriter
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more