Implemented guess for draw_pixel
This commit is contained in:
parent
78b6442fe3
commit
c91b1d8fe6
1 changed files with 12 additions and 1 deletions
13
src/lib.rs
13
src/lib.rs
|
|
@ -210,7 +210,18 @@ impl DoubleFrame<AutomaticPartialWindow> {
|
||||||
|
|
||||||
impl<PartialWindow: ApplyPartialWindow> DoubleFrame<PartialWindow> {
|
impl<PartialWindow: ApplyPartialWindow> DoubleFrame<PartialWindow> {
|
||||||
pub fn draw_pixel(&mut self, x: u16, y: u16, colour: PixelColour) {
|
pub fn draw_pixel(&mut self, x: u16, y: u16, colour: PixelColour) {
|
||||||
todo!()
|
self.partial_window.update_partial_window(x, x, y, y);
|
||||||
|
let x_i = x / 8;
|
||||||
|
let x_shift = x % 8;
|
||||||
|
let i = y * (EPD_WIDTH as u16 / 8) + x_i;
|
||||||
|
match colour {
|
||||||
|
PixelColour::Black => {
|
||||||
|
self.new.0[i as usize] &= !(1 << x_shift);
|
||||||
|
},
|
||||||
|
PixelColour::White => {
|
||||||
|
self.new.0[i as usize] |= 1 << x_shift;
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue