Run rustfmt
This commit is contained in:
parent
b04df71879
commit
290d5bf200
40
src/main.rs
40
src/main.rs
|
@ -12,7 +12,13 @@ fn main() -> anyhow::Result<()> {
|
|||
let mut saves = 0;
|
||||
for (x, y, px) in rimage.enumerate_pixels() {
|
||||
if prev_pixels.len() == 600 {
|
||||
save(rimage.width(), rimage.height(), &rimage, &prev_pixels, saves)?;
|
||||
save(
|
||||
rimage.width(),
|
||||
rimage.height(),
|
||||
&rimage,
|
||||
&prev_pixels,
|
||||
saves,
|
||||
)?;
|
||||
all_pixels.append(&mut prev_pixels);
|
||||
prev_pixels.clear();
|
||||
saves += 1;
|
||||
|
@ -33,22 +39,28 @@ fn main() -> anyhow::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn save(width: u32, height: u32, img: &image::ImageBuffer<image::Rgb<u8>, Vec<u8>>, pixels: &Vec<(u32, u32)>, iter: u32) -> anyhow::Result<()> {
|
||||
let mut out = image::ImageBuffer::new(width, height);
|
||||
fn save(
|
||||
width: u32,
|
||||
height: u32,
|
||||
img: &image::ImageBuffer<image::Rgb<u8>, Vec<u8>>,
|
||||
pixels: &Vec<(u32, u32)>,
|
||||
iter: u32,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut out = image::ImageBuffer::new(width, height);
|
||||
|
||||
for x in 0..width {
|
||||
for y in 0..height {
|
||||
let foo = image::Rgb([255, 255, 255]);
|
||||
out.put_pixel(x, y, foo);
|
||||
}
|
||||
for x in 0..width {
|
||||
for y in 0..height {
|
||||
let foo = image::Rgb([255, 255, 255]);
|
||||
out.put_pixel(x, y, foo);
|
||||
}
|
||||
}
|
||||
|
||||
for (x, y) in pixels {
|
||||
let px = img.get_pixel(*x, *y);
|
||||
out.put_pixel(*x, *y, *px);
|
||||
}
|
||||
for (x, y) in pixels {
|
||||
let px = img.get_pixel(*x, *y);
|
||||
out.put_pixel(*x, *y, *px);
|
||||
}
|
||||
|
||||
out.save(format!("output/{}.png", iter))?;
|
||||
out.save(format!("output/{}.png", iter))?;
|
||||
|
||||
Ok(())
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue