From b9a833ec5f1c550db1edc84e0b6c411cd2a77d31 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 18 Oct 2018 22:30:49 +0200 Subject: [PATCH] Revert "inverse the colors" This reverts commit 7dd826795ac8b74e82afe3996d5005d4c188469e. --- src/color.rs | 12 ++++++------ src/drawing.rs | 6 ++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/color.rs b/src/color.rs index 93c9506..7a83d44 100644 --- a/src/color.rs +++ b/src/color.rs @@ -12,23 +12,23 @@ impl Color { /// Get the color encoding of the color for one bit pub fn get_bit_value(&self) -> u8 { match self { - Color::White => 0u8, - Color::Black => 1u8, + Color::White => 1u8, + Color::Black => 0u8, } } /// Gets a full byte of black or white pixels pub fn get_byte_value(&self) -> u8 { match self { - Color::White => 0x00, - Color::Black => 0xff, + Color::White => 0xff, + Color::Black => 0x00, } } fn from_u8(val: u8) -> Self { match val { - 1 => Color::Black, - 0 => Color::White, + 0 => Color::Black, + 1 => Color::White, e => panic!("DisplayColor only parses 0 and 1 (Black and White) and not `{}`", e), } } diff --git a/src/drawing.rs b/src/drawing.rs index 98b7236..08b195c 100644 --- a/src/drawing.rs +++ b/src/drawing.rs @@ -98,12 +98,10 @@ impl Drawing for DisplayEink42BlackWhite { match color { Color::Black => { - //self.buffer[idx] &= !bit; - self.buffer[idx] |= bit; + self.buffer[idx] &= !bit; } Color::White => { - //self.buffer[idx] |= bit; - self.buffer[idx] &= !bit; + self.buffer[idx] |= bit; } } }