Add an image overlay effect
Lays a single picture from disk over its input: fitted, filled, stretched, left at its own size or tiled, centred or pinned to the top left corner, nudged by an offset and mixed in by its opacity. The file it needs is a new kind of param, Path, so the interface shows a chooser and the CLI takes a file name, both without knowing an overlay exists. Projects write it relative to their own folder, as they do a source, and Image::load can now hand back the alpha channel instead of flattening it onto white, so a cut-out PNG keeps its cut-out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+7
-1
@@ -10,7 +10,7 @@ namespace effector {
|
||||
// Declarative description of one effect knob. The GUI turns these into widgets
|
||||
// and the CLI turns them into flags, so neither knows about any effect.
|
||||
struct ParamSpec {
|
||||
enum class Type { Int, Double, Bool, Choice };
|
||||
enum class Type { Int, Double, Bool, Choice, Path };
|
||||
|
||||
Type type = Type::Int;
|
||||
std::string key;
|
||||
@@ -35,6 +35,10 @@ struct ParamSpec {
|
||||
std::string help = {});
|
||||
static ParamSpec makeChoice(std::string key, std::string label, std::string defaultChoice,
|
||||
std::vector<std::string> choices, std::string help = {});
|
||||
// A path to a file on disk, empty by default: a chooser in the interface, a
|
||||
// flag taking any string on the command line, written relative to the
|
||||
// project folder so that a folder still opens after it is moved.
|
||||
static ParamSpec makePath(std::string key, std::string label, std::string help = {});
|
||||
};
|
||||
|
||||
using ParamValue = std::variant<long, double, bool, std::string>;
|
||||
@@ -45,5 +49,7 @@ double paramDouble(const ParamValues& values, const std::string& key, double fal
|
||||
bool paramBool(const ParamValues& values, const std::string& key, bool fallback);
|
||||
std::string paramChoice(const ParamValues& values, const std::string& key,
|
||||
const std::string& fallback);
|
||||
std::string paramText(const ParamValues& values, const std::string& key,
|
||||
const std::string& fallback);
|
||||
|
||||
} // namespace effector
|
||||
|
||||
Reference in New Issue
Block a user