forked from AbleOS/ableos_userland
update v2
This commit is contained in:
parent
e75565d7ef
commit
7881ee2881
|
@ -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 {}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue