mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
expand FrameBuffer trait to interop with precursor details
This commit is contained in:
parent
7c4a97da97
commit
d9d48262ac
1 changed files with 8 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ pub mod op;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use blitstr2::GlyphSprite;
|
use blitstr2::GlyphSprite;
|
||||||
|
|
||||||
|
use crate::platform;
|
||||||
|
|
||||||
/// Abstract trait for a FrameBuffer. Slower than native manipulation
|
/// Abstract trait for a FrameBuffer. Slower than native manipulation
|
||||||
/// of the [u8] contents of a frame buffer, but more portable.
|
/// of the [u8] contents of a frame buffer, but more portable.
|
||||||
pub trait FrameBuffer {
|
pub trait FrameBuffer {
|
||||||
|
|
@ -36,12 +38,18 @@ pub trait FrameBuffer {
|
||||||
fn put_pixel(&mut self, p: Point, color: ColorNative);
|
fn put_pixel(&mut self, p: Point, color: ColorNative);
|
||||||
/// Retrieves a pixel value from the frame buffer; returns None if the point is out of bounds.
|
/// Retrieves a pixel value from the frame buffer; returns None if the point is out of bounds.
|
||||||
fn get_pixel(&mut self, p: Point) -> Option<ColorNative>;
|
fn get_pixel(&mut self, p: Point) -> Option<ColorNative>;
|
||||||
|
/// XORs a pixel to what is in the existing frame buffer. The exact definition of "XOR" is somewhat
|
||||||
|
/// ambiguous for full color systems but is generally meant to imply a light/dark swap of foreground
|
||||||
|
/// and background colors for a color theme.
|
||||||
|
fn xor_pixel(&mut self, p: Point);
|
||||||
/// Swaps the drawable buffer to the screen and sends it to the hardware
|
/// Swaps the drawable buffer to the screen and sends it to the hardware
|
||||||
fn draw(&mut self);
|
fn draw(&mut self);
|
||||||
/// Clears the drawable buffer
|
/// Clears the drawable buffer
|
||||||
fn clear(&mut self);
|
fn clear(&mut self);
|
||||||
/// Returns the size of the frame buffer as a Point
|
/// Returns the size of the frame buffer as a Point
|
||||||
fn dimensions(&self) -> Point;
|
fn dimensions(&self) -> Point;
|
||||||
|
/// Returns a raw pointer to the frame buffer
|
||||||
|
unsafe fn raw_mut(&mut self) -> &mut platform::FbRaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A TypesetWord is a Word that has beet turned into sprites and placed at a specific location on the canvas,
|
/// A TypesetWord is a Word that has beet turned into sprites and placed at a specific location on the canvas,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue