Add iterator over points in rect

This commit is contained in:
Joscha 2024-03-09 00:18:37 +01:00
parent 4f14d70152
commit e31eea8178
2 changed files with 13 additions and 11 deletions

View file

@ -59,12 +59,8 @@ impl<'a> View<'a> {
// More complicated drawing primitives
pub fn rect(&mut self, area: Rect, color: Srgba) {
let nw = area.corner_nw();
let se = area.corner_se();
for y in nw.y..=se.y {
for x in nw.x..=se.x {
self.set(Vec2::new(x, y), color);
}
for pos in area.points() {
self.set(pos, color);
}
}
}