diff options
Diffstat (limited to 'evc/src/debug.rs')
-rw-r--r-- | evc/src/debug.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/evc/src/debug.rs b/evc/src/debug.rs new file mode 100644 index 0000000..44b51cf --- /dev/null +++ b/evc/src/debug.rs @@ -0,0 +1,21 @@ +use crate::{frame::Frame, pixel::Pixel, view::View}; + +impl View<&mut Frame> { + pub fn draw_box(&mut self, color: Pixel) { + let w = self.size.0; + let h = self.size.1; + for x in 0..w { + self[(x, 0)] = color; + self[(x, h - 1)] = color; + } + for y in 0..h { + self[(0, y)] = color; + self[(w - 1, y)] = color; + } + } +} +impl Pixel { + pub const RED: Pixel = Pixel { r: 255, g: 0, b: 0 }; + pub const GREEN: Pixel = Pixel { r: 0, g: 255, b: 0 }; + pub const BLUE: Pixel = Pixel { r: 0, g: 0, b: 255 }; +} |