aboutsummaryrefslogtreecommitdiff
path: root/Plugins/merge_mod.cpp
diff options
context:
space:
mode:
authorJuha Vehviläinen <jusu@users.sourceforge.net>2003-02-17 22:28:16 +0000
committerJuha Vehviläinen <jusu@users.sourceforge.net>2003-02-17 22:28:16 +0000
commitba67bbb2db6327dc0f64eab24bafe5f023ce42ed (patch)
treee6448c5063b7fb2b021e32e31958d10a9a51fb07 /Plugins/merge_mod.cpp
parent2992b54a966b8972730a2552bb81183f07e35795 (diff)
0.32
svn path=/trunk/Framestein/; revision=418
Diffstat (limited to 'Plugins/merge_mod.cpp')
-rw-r--r--Plugins/merge_mod.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/Plugins/merge_mod.cpp b/Plugins/merge_mod.cpp
new file mode 100644
index 0000000..1aa9f16
--- /dev/null
+++ b/Plugins/merge_mod.cpp
@@ -0,0 +1,33 @@
+//
+// merge_additive - add color components of two images, mod 255
+//
+
+#include "plugin.h"
+#include "pixels.h"
+
+INFO("add color components of two images, modulus 255");
+
+void perform_copy(_frame f1, _frame f2, _args a)
+{
+ arguments ar(a.s);
+ pixels p1(f1), p2(f2);
+ int r, g, b;
+
+ float f = ar.count()>=1 ? atof(ar[0]) : 1;
+
+ while(!p1.eof() && !p2.eof())
+ {
+ r = (f * p1.red() + p2.red());
+ g = (f * p1.green() + p2.green());
+ b = (f * p1.blue() + p2.blue());
+
+ r = r % 255;
+ g = g % 255;
+ b = b % 255;
+
+ p2.putrgb(r, g, b);
+
+ p1.next();
+ p2.next();
+ }
+}