Effector: C++/CMake image effects app
Port of the Python prototype to C++20 with a CMake build: - effector_core: GUI-free static library (effects, image IO via gdk-pixbuf, declarative param specs, registry, portable seeded RNG, thread helper) - scanlines effect: plans strips from the seeded RNG, then copies pixels in parallel with memcpy and doubling horizontal tiling - gtkmm 4 interface: native file dialogs, widgets generated from the param specs, coalesced background renders, preview as a GDK memory texture - CLI: flags generated from the effect registry, headless rendering with no display required - ctest suite covering the RNG, registry, effect geometry and image round trip The Python prototype is kept under python-reference/.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#include "core/registry.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>(),
|
||||
};
|
||||
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
|
||||
Reference in New Issue
Block a user