Add support for transarent png images

This commit is contained in:
Nick Hahn
2021-12-28 02:27:37 +01:00
parent 95af2a0aca
commit b7330e6da6
2 changed files with 7 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ impl Painter {
}
// Get an RGB image
let image = self.image.as_mut().unwrap().to_rgb();
let image = self.image.as_mut().unwrap().to_rgba();
// Loop through all the pixels, and set their color
for x in 0..self.area.w {
@@ -68,7 +68,8 @@ impl Painter {
let channels = pixel.channels();
// Define the color
let color = Color::from(channels[0], channels[1], channels[2]);
let color = Color::from(channels[0], channels[1], channels[2], channels[3]);
// Set the pixel
if let Some(client) = &mut self.client {