update v2

This commit is contained in:
Able 2023-05-06 05:13:52 -05:00
parent e75565d7ef
commit 7881ee2881
2 changed files with 31 additions and 8 deletions

View file

@ -1,12 +1,38 @@
use embedded_graphics::{
pixelcolor::Rgb888,
prelude::{DrawTarget, IntoStorage, OriginDimensions, Size},
Pixel,
prelude::{DrawTarget, IntoStorage, OriginDimensions, PixelColor, Point, Size},
primitives::{Line, Primitive, PrimitiveStyle},
Drawable, Pixel,
};
pub struct Display {
pub fb: *mut u32,
pub size: Size,
pub color: Rgb888,
}
impl Display {
pub fn set_color(&mut self, color: Rgb888) {
self.color = color;
}
pub fn line(
&mut self,
x1: i32,
y1: i32,
x2: i32,
y2: i32,
thickness: u32,
) -> Result<(), BlitOutOfBoundsError> {
let color = self.color;
let style = PrimitiveStyle::with_stroke(color, thickness);
Line::new(Point::new(x1, y1), Point::new(x2, y2))
.into_styled(style)
.draw(&mut *self)?;
Ok(())
}
}
unsafe impl Send for Display {}

View file

@ -1,12 +1,9 @@
mod arch;
use core::fmt::Error;
use alloc::vec::Vec;
pub use arch::x86::Display;
pub struct Color {
r: u8,
g: u8,
b: u8,
a: u8,
}
use self::arch::x86::BlitOutOfBoundsError;