aboutsummaryrefslogtreecommitdiff
path: root/Plugins/fader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/fader.cpp')
-rw-r--r--Plugins/fader.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Plugins/fader.cpp b/Plugins/fader.cpp
new file mode 100644
index 0000000..5f26206
--- /dev/null
+++ b/Plugins/fader.cpp
@@ -0,0 +1,26 @@
+//
+// fader - fade image according to brightness of another image
+//
+
+#include "plugin.h"
+#include "pixels.h"
+
+INFO("fade image according to brightness of another image");
+
+void perform_copy(_frame f1, _frame f2, _args a)
+{
+ pixels p1(f1), p2(f2);
+ byte r, g, b;
+
+ while(!p1.eof() && !p2.eof())
+ {
+ r = p1.red() * (float)(p2.red() / 255.0);
+ g = p1.green() * (float)(p2.green() / 255.0);
+ b = p1.blue() * (float)(p2.blue() / 255.0);
+
+ p2.putrgb(r, g, b);
+
+ p1.next();
+ p2.next();
+ }
+}