Add a blur effect plugin

Fills the canvas from one source, tiling it when it is smaller, then
applies a separable box blur repeated `passes` times to approximate a
gaussian. Params: radius, passes, direction and first_source, so the CLI
flags and the GUI widgets come out of the ParamSpecs as usual.

All random values (source index and crop offset) are drawn serially
before the parallel pixel work, so a seed reproduces the image exactly;
the box window clamps at both ends and the radius is clamped to the
canvas so an oversized radius cannot read out of bounds.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Si
2026-09-18 15:05:15 +02:00
co-authored by Claude Opus 5
parent 887a079c70
commit ee4b1038ac
5 changed files with 234 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include "core/effect.hpp"
namespace effector {
// Fills the canvas with one of the sources and softens it with a separable box
// blur, repeated a few times to approximate a gaussian.
class BlurEffect : public Effect {
public:
std::string name() const override { return "blur"; }
std::string title() const override { return "Blur"; }
std::string description() const override {
return "Fills the canvas from a randomly chosen source and softens it with a repeated "
"box blur, horizontally, vertically or both.";
}
const std::vector<ParamSpec>& params() const override;
Image render(const std::vector<Image>& sources, int width, int height, Rng& rng,
const ParamValues& values) const override;
};
} // namespace effector