Add Image widget

This commit is contained in:
Joscha 2024-03-09 22:17:41 +01:00
parent a0c94c1884
commit ef5f0e3af4
5 changed files with 203 additions and 0 deletions

View file

@ -67,4 +67,13 @@ impl<'a> View<'a> {
self.set(pos, color);
}
}
pub fn image(&mut self, image: &RgbaImage) {
for y in 0..image.height() {
for x in 0..image.width() {
let color = color::from_image_color(*image.get_pixel(x, y));
self.set(Vec2::from_u32(x, y), color);
}
}
}
}