From 4d64e4cd434426234a5c313c151cd79b6afc299e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Sat, 6 Jul 2002 17:50:18 +0000 Subject: *** empty log message *** svn path=/trunk/Framestein/; revision=27 --- Plugins/bend.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 Plugins/bend.c (limited to 'Plugins/bend.c') diff --git a/Plugins/bend.c b/Plugins/bend.c new file mode 100644 index 0000000..753159d --- /dev/null +++ b/Plugins/bend.c @@ -0,0 +1,86 @@ +#include +#include +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + printf("NOTE: bend as effect does nothing. Use bend as copy operation.\n"); +} + +void perform_copy(_frame f1, _frame f2, _args a) +{ + int x, y, w, h, pos, pos2, src, ysrc, ypos1, ypos2, + widthminuspos, widthminuspos2, widthminusone, + heightminusypos1, heightminusypos2; + pixel8 *p1, *p2, tp=0, tpy=0; + char *t; + byte pixelsize = f1.pixelformat/8; + + if(!a.s) return; + pos = atoi(a.s); + if(t = strstr(a.s, " ")) + { + pos2 = atoi(t+1); + tp = 1; + if(t = strstr(t+1, " ")) + { + ypos1 = atoi(t+1); + if(t = strstr(t+1, " ")) + { + ypos2 = atoi(t+1); + if(ypos1>0||ypos2>0) tpy = 1; + } + } + } + + w = f1.width=w) pos=w-1; + if(pos2<0) pos2=0; + if(pos2>=w) pos2=w-1; + + if(ypos1<0) ypos1=0; + if(ypos1>=w) ypos1=w-1; + if(ypos2<0) ypos2=0; + if(ypos2>=w) ypos2=w-1; + + widthminuspos = f1.width-pos; + widthminuspos2 = f1.width-pos2; + widthminusone = w-1; + + heightminusypos1 = f1.height-ypos1; + heightminusypos2 = f1.height-ypos2; + + // here we'll avoid checking for pixelformat by taking the source and destination + // offsets as 8-bit, and multiplying that by pixelsize + + for(y=0; y