Skip to main content

BufferedLcd

Struct BufferedLcd 

Source
pub struct BufferedLcd<L: Lcd> { /* private fields */ }
Expand description

Implements buffering for a backing slow LCD L that renders text with the font F.

All drawing operations are saved to a memory-backed framebuffer. If syncing is enabled, drawing primitives are flushed right away to the device; otherwise, they are applied to memory only until an explicit sync is requested. The framebuffer is also used to implement all pixel data reading.

Implementations§

Source§

impl<L> BufferedLcd<L>
where L: Lcd,

Source

pub fn new(lcd: L, font: &'static Font) -> Self

Creates a new buffered LCD backed by lcd.

Trait Implementations§

Source§

impl<L> Drop for BufferedLcd<L>
where L: Lcd,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<L> RasterOps for BufferedLcd<L>
where L: Lcd,

Source§

type ID = (Vec<u8>, SizeInPixels)

Type of the image data (raw pixels).
Source§

fn get_info(&self) -> RasterInfo

Queries information about the backend.
Source§

fn set_draw_color(&mut self, color: RGB)

Sets the drawing color for subsequent operations.
Source§

fn clear(&mut self) -> Result<()>

Clears the whole console with the given color.
Source§

fn set_sync(&mut self, enabled: bool)

Sets whether automatic presentation of the canvas is enabled or not. Read more
Source§

fn present_canvas(&mut self) -> Result<()>

Displays any buffered changes to the console. Read more
Source§

fn read_pixels(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<Self::ID>

Reads the raw pixel data for the rectangular region specified by xy and size.
Source§

fn put_pixels(&mut self, xy: PixelsXY, (pixels, size): &Self::ID) -> Result<()>

Restores the rectangular region stored in data at the xy coordinates.
Source§

fn move_pixels( &mut self, x1y1: PixelsXY, x2y2: PixelsXY, size: SizeInPixels, ) -> Result<()>

Moves the rectangular region specified by x1y1 and size to x2y2. The original region is erased with the current drawing color.
Source§

fn write_text(&mut self, xy: PixelsXY, text: &str) -> Result<()>

Writes text starting at xy with the current drawing color.
Source§

fn draw_circle(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws the outline of a circle at center with radius using the current drawing color.
Source§

fn draw_circle_filled(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws a filled circle at center with radius using the current drawing color.
Source§

fn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>

Draws a line from x1y1 to x2y2 using the current drawing color.
Source§

fn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>

Draws a single pixel at xy using the current drawing color.
Source§

fn draw_rect(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>

Draws the outline of a rectangle from x1y1 to x2y2 using the current drawing color.
Source§

fn draw_rect_filled(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>

Draws a filled rectangle from x1y1 to x2y2 using the current drawing color.

Auto Trait Implementations§

§

impl<L> Freeze for BufferedLcd<L>
where L: Freeze, <L as Lcd>::Pixel: Freeze,

§

impl<L> RefUnwindSafe for BufferedLcd<L>
where L: RefUnwindSafe, <L as Lcd>::Pixel: RefUnwindSafe,

§

impl<L> Send for BufferedLcd<L>
where L: Send, <L as Lcd>::Pixel: Send,

§

impl<L> Sync for BufferedLcd<L>
where L: Sync, <L as Lcd>::Pixel: Sync,

§

impl<L> Unpin for BufferedLcd<L>
where L: Unpin, <L as Lcd>::Pixel: Unpin,

§

impl<L> UnsafeUnpin for BufferedLcd<L>
where L: UnsafeUnpin, <L as Lcd>::Pixel: UnsafeUnpin,

§

impl<L> UnwindSafe for BufferedLcd<L>
where L: UnwindSafe, <L as Lcd>::Pixel: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V