Add image accumulation entry point
I was hoping to implement the image filter/reduction step as well, but that seems to be meaningfully more complex
This commit is contained in:
@@ -2,6 +2,7 @@ use anyhow::{Context, Result};
|
||||
use enkou_shaders::Coefficients2;
|
||||
use enkou_shaders::camera::Camera;
|
||||
use enkou_shaders::chaos_game::ChaosGame;
|
||||
use enkou_shaders::image::{BlendMode, ImageSettings};
|
||||
use enkou_shaders::transform::Transform;
|
||||
use enkou_shaders::variation::Variation;
|
||||
use glam::{Affine2, UVec2, Vec2, uvec2, vec2};
|
||||
@@ -50,6 +51,8 @@ pub fn main() -> Result<()> {
|
||||
IMAGE_DIMENSION.as_vec2(),
|
||||
);
|
||||
|
||||
let image_settings = ImageSettings::new(BlendMode::Linear, IMAGE_DIMENSION);
|
||||
|
||||
let mut image = GrayImage::new(IMAGE_DIMENSION.x, IMAGE_DIMENSION.y);
|
||||
|
||||
let chaos_game = ChaosGame::new(&mut rng, &transforms, &weights, &variations);
|
||||
@@ -57,7 +60,8 @@ pub fn main() -> Result<()> {
|
||||
chaos_game
|
||||
.skip(ITERATIONS_DISCARD)
|
||||
.take(ITERATIONS)
|
||||
.filter_map(|(point_ifs, _)| camera.transform_point_to_image(point_ifs))
|
||||
.map(|(point_ifs, _)| camera.transform_point(point_ifs))
|
||||
.filter_map(|point_pixel| image_settings.transform_point_to_image(point_pixel))
|
||||
.for_each(|point_pixel| image.put_pixel(point_pixel.x, point_pixel.y, Luma([255])));
|
||||
|
||||
let temp = NamedTempFile::with_suffix(".png").context("Unable to create file for image")?;
|
||||
|
||||
Reference in New Issue
Block a user