[−][src]Struct sunrise_vi::vbe::Framebuffer
A wrapper around a linear framebuffer. The framebuffer is usually acquired through the map_framebuffer syscall.
Fields
buf: &'a mut [VBEColor]
width: usize
height: usize
bpp: usize
Bits-per-pixel. Usually 8.
Implementations
impl<'a> Framebuffer<'a>
[src]
pub fn new() -> Result<Framebuffer<'static>, Error>
[src]
Creates an instance of the linear framebuffer.
Safety
This function should only be called once, to ensure there is only a single mutable reference to the underlying framebuffer.
pub fn new_buffer(
buf: &'a mut [VBEColor],
width: usize,
height: usize,
bpp: usize
) -> Framebuffer<'a>
[src]
buf: &'a mut [VBEColor],
width: usize,
height: usize,
bpp: usize
) -> Framebuffer<'a>
Creates a backbuffer backed by an in-memory array.
This is useful to avoid flickering and other display artifact. Compositing should happen in such a backbuffer, and the final result should then be copied into the actual framebuffer.
pub fn width(&self) -> usize
[src]
framebuffer width in pixels. Does not account for bpp
pub fn height(&self) -> usize
[src]
framebuffer height in pixels. Does not account for bpp
pub fn bpp(&self) -> usize
[src]
The number of bits that forms a pixel. Used to compute offsets in framebuffer memory to corresponding pixel px_offset = px_nbr * bpp
pub fn get_px_offset(&self, x: usize, y: usize) -> usize
[src]
Gets the offset in memory of a pixel based on an x and y.
Panics
Panics if y >= self.height()
or x >= self.width()
pub fn write_px(&mut self, offset: usize, color: VBEColor)
[src]
pub fn write_px_at(&mut self, x: usize, y: usize, color: VBEColor)
[src]
Writes a pixel in the framebuffer respecting the bgr pattern Computes the offset in the framebuffer from x and y
Panics
Panics if coords are invalid
pub fn get_fb(&mut self) -> &mut [VBEColor]
[src]
Gets the underlying framebuffer
pub fn clear(&mut self)
[src]
Clears the whole screen
pub fn clear_at(&mut self, x: usize, y: usize, width: usize, height: usize)
[src]
Clears a segment of the screen.
Panics
Panics if x + width or y + height falls outside the framebuffer.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Framebuffer<'a>
impl<'a> Send for Framebuffer<'a>
impl<'a> Sync for Framebuffer<'a>
impl<'a> Unpin for Framebuffer<'a>
impl<'a> !UnwindSafe for Framebuffer<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SizedIPCBuffer for T
[src]
fn size(&self) -> usize
[src]
fn is_cool(addr: usize, size: usize) -> bool
[src]
unsafe fn from_raw_parts<'a>(addr: usize, _size: usize) -> &'a T
[src]
unsafe fn from_raw_parts_mut<'a>(addr: usize, _size: usize) -> &'a mut T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,