simple.rs |
let mut png_data: Vec<u8> = vec![0; (width * height * 3) as usize];
let mut i = 0;
for pixel in data {
png_data[i] = ((pixel >> 16) & 0xff) as u8;
png_data[i + 1] = ((pixel >> 8) & 0xff) as u8;
png_data[i + 2] = ((pixel >> 0) & 0xff) as u8;
i += 3;
} |
2994 |