aboutsummaryrefslogtreecommitdiff
path: root/Plugins/copy_vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/copy_vert.c')
-rw-r--r--Plugins/copy_vert.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Plugins/copy_vert.c b/Plugins/copy_vert.c
new file mode 100644
index 0000000..cb7b093
--- /dev/null
+++ b/Plugins/copy_vert.c
@@ -0,0 +1,30 @@
+#include <stdlib.h>
+#include <string.h>
+#include "plugin.h"
+
+void perform_copy(_frame f1, _frame f2, _args a)
+{
+ byte pixelsize = f1.pixelformat/8;
+ short x, y, xoff, w, h, size=1;
+ char *t;
+
+ if(!a.s) return;
+ xoff = atoi(a.s);
+
+ if(t = strstr(a.s, " ")) size=atoi(t+1);
+
+ w = f1.width<f2.width ? f1.width : f2.width;
+ h = f1.height<f2.height ? f1.height : f2.height;
+
+ if(xoff+size>=w)
+ {
+ size = w - xoff;
+ if(!size) return;
+ }
+
+ if(xoff<0 || xoff>=w) return;
+
+ for(y=0; y<h; y++)
+ memcpy(&f2.bits[y*f2.lpitch+xoff*pixelsize], &f1.bits[y*f1.lpitch+xoff*pixelsize],
+ size*pixelsize);
+}