aboutsummaryrefslogtreecommitdiff
path: root/Plugins/subtract.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/subtract.cpp')
-rw-r--r--Plugins/subtract.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Plugins/subtract.cpp b/Plugins/subtract.cpp
new file mode 100644
index 0000000..89ba216
--- /dev/null
+++ b/Plugins/subtract.cpp
@@ -0,0 +1,38 @@
+// 0.20
+// - from c to c++
+// - pixelformat-aware
+
+#include <stdlib.h>
+#include <string.h>
+#include "plugin.h"
+#include "pixels.h"
+
+void perform_effect(_frame f, _args a)
+{
+ pixels p(f);
+ char *t;
+ byte tr, tg, tb, r=0, g=0, b=0;
+
+ if(!a.s) return;
+
+ r = atoi(a.s);
+ if(t = strstr(a.s, " "))
+ {
+ g = atoi(t+1);
+ if (t = strstr(t+1, " "))
+ b = atoi(t+1);
+ }
+
+ while(!p.eof())
+ {
+ tr = p.red();
+ tg = p.green();
+ tb = p.blue();
+ p.putrgb(
+ tr>r ? tr-r : 0,
+ tg>g ? tg-g : 0,
+ tb>b ? tb-b : 0
+ );
+ p.next();
+ }
+}