update v2

master
Able 2023-05-06 05:13:52 -05:00
parent e3cc98495d
commit 70a65fc10d
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;