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>
32 lines
868 B
C++
32 lines
868 B
C++
#include "core/registry.hpp"
|
|
|
|
#include "effects/blur.hpp"
|
|
#include "effects/scanlines.hpp"
|
|
|
|
namespace effector {
|
|
|
|
// To add an effect: include its header and add one line here.
|
|
const std::vector<EffectPtr>& effects() {
|
|
static const std::vector<EffectPtr> registry = {
|
|
std::make_shared<ScanlinesEffect>(),
|
|
std::make_shared<BlurEffect>(),
|
|
};
|
|
return registry;
|
|
}
|
|
|
|
EffectPtr effectByName(const std::string& name) {
|
|
for (const auto& effect : effects()) {
|
|
if (effect->name() == name) return effect;
|
|
}
|
|
std::string known;
|
|
for (const auto& effect : effects()) {
|
|
if (!known.empty()) known += ", ";
|
|
known += effect->name();
|
|
}
|
|
throw EffectError("Unknown effect '" + name + "' (available: " + known + ")");
|
|
}
|
|
|
|
std::string defaultEffectName() { return effects().front()->name(); }
|
|
|
|
} // namespace effector
|