Add image accumulation entry point
CI / cargo fmt (push) Failing after 59s
CI / cargo test (push) Successful in 16m1s
CI / cargo test (GPU) (push) Has been cancelled

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:
2026-07-19 19:45:44 -04:00
parent 81a1a2a254
commit e688de5204
9 changed files with 182 additions and 60 deletions
+5 -1
View File
@@ -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")?;