aboutsummaryrefslogtreecommitdiff
path: root/evc/src/debug.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-12-06 09:06:30 +0100
committermetamuffin <metamuffin@disroot.org>2022-12-06 09:06:30 +0100
commit86eda32f9d8fed77136ffd3495e93c4c37e7671b (patch)
tree8ce0b9eb22336ae19e5fae85c45ef376bd546ce9 /evc/src/debug.rs
parentd5179b3cc79bda5aa346f111be493f3f9b223d30 (diff)
downloadvideo-codec-experiments-86eda32f9d8fed77136ffd3495e93c4c37e7671b.tar
video-codec-experiments-86eda32f9d8fed77136ffd3495e93c4c37e7671b.tar.bz2
video-codec-experiments-86eda32f9d8fed77136ffd3495e93c4c37e7671b.tar.zst
debug draw
Diffstat (limited to 'evc/src/debug.rs')
-rw-r--r--evc/src/debug.rs21
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 };
+}