aboutsummaryrefslogtreecommitdiff
path: root/Plugins
diff options
context:
space:
mode:
authorJuha Vehviläinen <jusu@users.sourceforge.net>2002-09-18 16:32:27 +0000
committerJuha Vehviläinen <jusu@users.sourceforge.net>2002-09-18 16:32:27 +0000
commit3bd43c9d18e565e193e555f9de0ce916f8faf807 (patch)
tree81b3938b9863edf96efa6e0b1adf33081da5f440 /Plugins
parentabe3e28bb8c11236f42046e1c1fd6f809b00a823 (diff)
*** empty log message ***
svn path=/trunk/Framestein/; revision=132
Diffstat (limited to 'Plugins')
-rw-r--r--Plugins/argument-passing.cpp18
-rw-r--r--Plugins/argument-passing.dllbin0 -> 40960 bytes
-rw-r--r--Plugins/argument-passing.expbin0 -> 662 bytes
-rw-r--r--Plugins/argument-passing.libbin0 -> 2200 bytes
-rw-r--r--Plugins/argument-passing.objbin0 -> 2854 bytes
-rw-r--r--Plugins/makefile7
-rw-r--r--Plugins/pixels.h30
-rw-r--r--Plugins/rowca.cpp16
-rw-r--r--Plugins/rowca.dllbin110592 -> 110592 bytes
-rw-r--r--Plugins/rowca.expbin619 -> 619 bytes
-rw-r--r--Plugins/rowca.libbin2042 -> 2042 bytes
-rw-r--r--Plugins/rowca.objbin57594 -> 61510 bytes
-rw-r--r--Plugins/subtract.cpp31
-rw-r--r--Plugins/subtract.dllbin28672 -> 40960 bytes
-rw-r--r--Plugins/subtract.expbin630 -> 630 bytes
-rw-r--r--Plugins/subtract.libbin2080 -> 2080 bytes
-rw-r--r--Plugins/subtract.objbin1409 -> 5262 bytes
17 files changed, 84 insertions, 18 deletions
diff --git a/Plugins/argument-passing.cpp b/Plugins/argument-passing.cpp
new file mode 100644
index 0000000..71ec33c
--- /dev/null
+++ b/Plugins/argument-passing.cpp
@@ -0,0 +1,18 @@
+//
+// example of passing arguments to plugin using the arguments-class (defined in pixels.h)
+//
+
+#include "pixels.h"
+
+void perform_effect(_frame f, _args a)
+{
+ arguments ar(a.s);
+
+ //
+ // ar.count() return the number of arguments
+ // ar[i] return i'th argument
+ //
+
+ for(int i=0; i<ar.count(); i++)
+ printf("argument %d: %s\n", i, ar[i]);
+}
diff --git a/Plugins/argument-passing.dll b/Plugins/argument-passing.dll
new file mode 100644
index 0000000..dfa112e
--- /dev/null
+++ b/Plugins/argument-passing.dll
Binary files differ
diff --git a/Plugins/argument-passing.exp b/Plugins/argument-passing.exp
new file mode 100644
index 0000000..d3e522e
--- /dev/null
+++ b/Plugins/argument-passing.exp
Binary files differ
diff --git a/Plugins/argument-passing.lib b/Plugins/argument-passing.lib
new file mode 100644
index 0000000..bc5bbf9
--- /dev/null
+++ b/Plugins/argument-passing.lib
Binary files differ
diff --git a/Plugins/argument-passing.obj b/Plugins/argument-passing.obj
new file mode 100644
index 0000000..2c1a88d
--- /dev/null
+++ b/Plugins/argument-passing.obj
Binary files differ
diff --git a/Plugins/makefile b/Plugins/makefile
index 8a1dd91..928c4b7 100644
--- a/Plugins/makefile
+++ b/Plugins/makefile
@@ -5,7 +5,7 @@ all: noize colortv subtract xbend bend gol shuffle green \
multiply overlay screen shadowcaster softlight \
rgbseek modgain traffic constrain eclipse eclipse02 eclipse03 \
cga keyscreen rene cutout fromage rgbavg rgbavg02 \
- rowca
+ rowca argument-passing
dir *.dll
@@ -26,7 +26,7 @@ colortv:
cl colortv.c $(FLAGS) /link $(BOTH)
subtract:
- cl subtract.cpp $(FLAGS) /link $(EFFECT)
+ cl subtract.cpp $(FLAGS) /GX /link $(EFFECT)
xbend:
cl xbend.c $(FLAGS) /link $(BOTH)
@@ -185,3 +185,6 @@ rgbavg02:
rowca:
cl rowca.cpp $(FLAGS) /GX /link $(EFFECT)
+
+argument-passing:
+ cl argument-passing.cpp $(FLAGS) /GX /link $(EFFECT)
diff --git a/Plugins/pixels.h b/Plugins/pixels.h
index 9557ea8..8ea645c 100644
--- a/Plugins/pixels.h
+++ b/Plugins/pixels.h
@@ -6,11 +6,12 @@
// - dot16() dot24() and dot32() added
// - get/put dot() removed, use above
-#include "plugin.h"
-
#ifndef _PIXELSH
#define _PIXELSH
+#include <vector>
+#include "plugin.h"
+
class pixels
{
private:
@@ -117,4 +118,29 @@ void pixels::updaterowp()
p32 = (pixel32 *)p8;
}
+//
+// arguments-class, to make it easier to parse parameters.
+// using vector<char *> for this might be a bit overkill (??),
+// but I like the ease of it.
+
+class arguments
+{
+private:
+ std::vector<char *> m_ptrs;
+public:
+ arguments(char *s)
+ {
+ char *t = s;
+ if(!t || !t[0]) return;
+ if(t[0]) m_ptrs.push_back(t);
+ while(t = strstr(t+1, " "))
+ {
+ t[0]=0;
+ m_ptrs.push_back(t+1);
+ }
+ }
+ char *operator[](int i) { return m_ptrs[i]; }
+ int count() { return m_ptrs.size(); }
+};
+
#endif // #ifndef _PIXELSH
diff --git a/Plugins/rowca.cpp b/Plugins/rowca.cpp
index 5c776ac..de83933 100644
--- a/Plugins/rowca.cpp
+++ b/Plugins/rowca.cpp
@@ -42,11 +42,19 @@ void draw(const _frame &f);
void perform_effect(_frame f, _args a)
{
- if(!a.s || !a.s[0]) return;
+ arguments ar(a.s);
+ if(!ar.count()) {
+ printf("Usage: rowca <rule of automata, or command>\n");
+ printf("Example rule: 001-010-011-100\n");
+ printf("Commands: draw, clear\n");
+ return;
+ }
+
+ char *t = ar[0];
- if(strstr(a.s, "0") || strstr(a.s, "1")) iterate(a.s); else
- if(strcmp(a.s, "draw")==0) draw(f); else
- if(strcmp(a.s, "clear")==0) sv.clear();
+ if(strstr(t, "0") || strstr(t, "1")) iterate(t); else
+ if(strcmp(t, "draw")==0) draw(f); else
+ if(strcmp(t, "clear")==0) sv.clear();
}
void iterate(const char *arg)
diff --git a/Plugins/rowca.dll b/Plugins/rowca.dll
index eda7177..5302341 100644
--- a/Plugins/rowca.dll
+++ b/Plugins/rowca.dll
Binary files differ
diff --git a/Plugins/rowca.exp b/Plugins/rowca.exp
index be126fa..9fcaa42 100644
--- a/Plugins/rowca.exp
+++ b/Plugins/rowca.exp
Binary files differ
diff --git a/Plugins/rowca.lib b/Plugins/rowca.lib
index 78df6e5..ce2557f 100644
--- a/Plugins/rowca.lib
+++ b/Plugins/rowca.lib
Binary files differ
diff --git a/Plugins/rowca.obj b/Plugins/rowca.obj
index c57f120..5ce3a87 100644
--- a/Plugins/rowca.obj
+++ b/Plugins/rowca.obj
Binary files differ
diff --git a/Plugins/subtract.cpp b/Plugins/subtract.cpp
index 89ba216..3172513 100644
--- a/Plugins/subtract.cpp
+++ b/Plugins/subtract.cpp
@@ -1,3 +1,9 @@
+//
+// subtract - subtract red/green/blue color from image
+//
+// 0.32
+// using arguments-class
+//
// 0.20
// - from c to c++
// - pixelformat-aware
@@ -9,30 +15,35 @@
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;
+ arguments ar(a.s);
- r = atoi(a.s);
- if(t = strstr(a.s, " "))
+ if(ar.count()!=3)
{
- g = atoi(t+1);
- if (t = strstr(t+1, " "))
- b = atoi(t+1);
+ printf("usage: subtract <red> <green> <blue>\n");
+ return;
}
+ byte r, g, b;
+
+ r = atoi(ar[0]);
+ g = atoi(ar[1]);
+ b = atoi(ar[2]);
+
+ pixels p(f);
+ byte tr, tg, tb;
+
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();
}
}
diff --git a/Plugins/subtract.dll b/Plugins/subtract.dll
index 883c541..65383b3 100644
--- a/Plugins/subtract.dll
+++ b/Plugins/subtract.dll
Binary files differ
diff --git a/Plugins/subtract.exp b/Plugins/subtract.exp
index 9a066ba..0c88e2c 100644
--- a/Plugins/subtract.exp
+++ b/Plugins/subtract.exp
Binary files differ
diff --git a/Plugins/subtract.lib b/Plugins/subtract.lib
index 5132561..ad174a2 100644
--- a/Plugins/subtract.lib
+++ b/Plugins/subtract.lib
Binary files differ
diff --git a/Plugins/subtract.obj b/Plugins/subtract.obj
index 8405ccc..bb9e9fa 100644
--- a/Plugins/subtract.obj
+++ b/Plugins/subtract.obj
Binary files differ