aboutsummaryrefslogtreecommitdiff
path: root/Plugins/makesliders.c
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/makesliders.c')
-rw-r--r--Plugins/makesliders.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/Plugins/makesliders.c b/Plugins/makesliders.c
new file mode 100644
index 0000000..5c0b209
--- /dev/null
+++ b/Plugins/makesliders.c
@@ -0,0 +1,40 @@
+//
+// makesliders: display slider values
+//
+// usage: makesliders 14 56 76 140
+// displays four sliders with given values
+//
+
+#include <string.h>
+#include "plugin.h"
+
+#define MAXVALS 128
+
+void perform_effect(_frame f, _args a)
+{
+ pixel8 *p8;
+ char *t=a.s;
+ int val[MAXVALS], valcount=0, i, y, bitsperpixel=f.pixelformat / 8, col;
+
+ if(!t) return;
+
+ while(t && valcount<MAXVALS)
+ {
+ val[valcount++] = atoi(t);
+ t = strstr(t, " ");
+ if(t) t++;
+ }
+
+ memset(f.bits, 0, f.height*f.lpitch);
+ col = rand()%256;
+
+ for(i=0; i<f.width; i++)
+ {
+ y = val[(int)(i / (float)f.width * (float)valcount)];
+ if(y>=0 && y<f.height)
+ {
+ p8 = scanline(f, y);
+ memset(p8+i*bitsperpixel, 200, bitsperpixel);
+ }
+ }
+}