pub struct Screen { /* private fields */ }Expand description
Represents the physical display on the V5 Brain.
Implementations§
Source§impl Screen
impl Screen
Sourcepub const MAX_VISIBLE_LINES: usize = 12usize
pub const MAX_VISIBLE_LINES: usize = 12usize
The maximum number of lines that can be visible on the screen at once.
Sourcepub const LINE_HEIGHT: i16 = 20i16
pub const LINE_HEIGHT: i16 = 20i16
The height of a single line of text on the screen.
Sourcepub const HORIZONTAL_RESOLUTION: i16 = 480i16
pub const HORIZONTAL_RESOLUTION: i16 = 480i16
The horizontal resolution of the display.
Sourcepub const VERTICAL_RESOLUTION: i16 = 240i16
pub const VERTICAL_RESOLUTION: i16 = 240i16
The vertical resolution of the writable part of the display.
Sourcepub unsafe fn new() -> Self
pub unsafe fn new() -> Self
Create a new screen.
§Safety
Creating new Screens is inherently unsafe due to the possibility of constructing
more than one screen at once allowing multiple mutable references to the same
hardware device. Prefer using Peripherals to register devices if possible.
Sourcepub fn scroll(&mut self, start: i16, offset: i16) -> Result<(), ScreenError>
pub fn scroll(&mut self, start: i16, offset: i16) -> Result<(), ScreenError>
Scroll the entire display buffer.
This function effectively y-offsets all pixels drawn to the display buffer by
a number (offset) of pixels.
Sourcepub fn scroll_area(
&mut self,
x0: i16,
y0: i16,
x1: i16,
y1: i16,
offset: i16,
) -> Result<(), ScreenError>
pub fn scroll_area( &mut self, x0: i16, y0: i16, x1: i16, y1: i16, offset: i16, ) -> Result<(), ScreenError>
Scroll a region of the screen.
This will effectively y-offset the display buffer in this area by
offset pixels.
Sourcepub fn fill(
&mut self,
shape: &impl Fill<Error = ScreenError>,
color: impl IntoRgb,
) -> Result<(), ScreenError>
pub fn fill( &mut self, shape: &impl Fill<Error = ScreenError>, color: impl IntoRgb, ) -> Result<(), ScreenError>
Draw a filled object to the screen.
Sourcepub fn stroke(
&mut self,
shape: &impl Stroke<Error = ScreenError>,
color: impl IntoRgb,
) -> Result<(), ScreenError>
pub fn stroke( &mut self, shape: &impl Stroke<Error = ScreenError>, color: impl IntoRgb, ) -> Result<(), ScreenError>
Draw an outlined object to the screen.
Sourcepub fn erase(color: impl IntoRgb) -> Result<(), ScreenError>
pub fn erase(color: impl IntoRgb) -> Result<(), ScreenError>
Wipe the entire display buffer, filling it with a specified color.
Sourcepub fn draw_pixel(x: i16, y: i16) -> Result<(), ScreenError>
pub fn draw_pixel(x: i16, y: i16) -> Result<(), ScreenError>
Draw a color to a specified pixel position on the screen.
Sourcepub fn draw_buffer<T, I>(
&mut self,
x0: i16,
y0: i16,
x1: i16,
y1: i16,
buf: T,
src_stride: i32,
) -> Result<(), ScreenError>where
T: IntoIterator<Item = I>,
I: IntoRgb,
pub fn draw_buffer<T, I>(
&mut self,
x0: i16,
y0: i16,
x1: i16,
y1: i16,
buf: T,
src_stride: i32,
) -> Result<(), ScreenError>where
T: IntoIterator<Item = I>,
I: IntoRgb,
Draw a buffer of pixel colors to a specified region of the screen.
Sourcepub fn draw_error(&mut self, msg: &str) -> Result<(), ScreenError>
pub fn draw_error(&mut self, msg: &str) -> Result<(), ScreenError>
Draw an error box to the screen.
This function is internally used by the pros-rs panic handler for displaying panic messages graphically before exiting.
Sourcepub fn touch_status(&self) -> Result<TouchEvent, ScreenError>
pub fn touch_status(&self) -> Result<TouchEvent, ScreenError>
Get the current touch status of the screen.