blob: 7b27b8348809d8079321d38a6b6fb787816a6ca9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.x;
let h = self.size.y;
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 };
}
|