diff options
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/2colors.cpp | 21 | ||||
-rw-r--r-- | Plugins/2colors.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/2colors.exp | bin | 0 -> 627 bytes | |||
-rw-r--r-- | Plugins/2colors.lib | bin | 0 -> 2066 bytes | |||
-rw-r--r-- | Plugins/2colors.obj | bin | 0 -> 1133 bytes | |||
-rw-r--r-- | Plugins/README.txt | 12 | ||||
-rw-r--r-- | Plugins/bend.c | 86 | ||||
-rw-r--r-- | Plugins/bend.dll | bin | 0 -> 49152 bytes | |||
-rw-r--r-- | Plugins/bend.exp | bin | 0 -> 697 bytes | |||
-rw-r--r-- | Plugins/bend.lib | bin | 0 -> 2110 bytes | |||
-rw-r--r-- | Plugins/bend.obj | bin | 0 -> 1726 bytes | |||
-rw-r--r-- | Plugins/black.c | 13 | ||||
-rw-r--r-- | Plugins/black.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/black.exp | bin | 0 -> 700 bytes | |||
-rw-r--r-- | Plugins/black.lib | bin | 0 -> 2120 bytes | |||
-rw-r--r-- | Plugins/black.obj | bin | 0 -> 560 bytes | |||
-rw-r--r-- | Plugins/colortv.c | 69 | ||||
-rw-r--r-- | Plugins/colortv.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/colortv.exp | bin | 0 -> 708 bytes | |||
-rw-r--r-- | Plugins/colortv.lib | bin | 0 -> 2146 bytes | |||
-rw-r--r-- | Plugins/colortv.obj | bin | 0 -> 864 bytes | |||
-rw-r--r-- | Plugins/copy_vert.c | 30 | ||||
-rw-r--r-- | Plugins/copy_vert.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/copy_vert.exp | bin | 0 -> 583 bytes | |||
-rw-r--r-- | Plugins/copy_vert.lib | bin | 0 -> 1970 bytes | |||
-rw-r--r-- | Plugins/copy_vert.obj | bin | 0 -> 816 bytes | |||
-rw-r--r-- | Plugins/fs2vf.c | 49 | ||||
-rw-r--r-- | Plugins/fs2vf.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/fs2vf.exp | bin | 0 -> 575 bytes | |||
-rw-r--r-- | Plugins/fs2vf.lib | bin | 0 -> 1932 bytes | |||
-rw-r--r-- | Plugins/fs2vf.obj | bin | 0 -> 1894 bytes | |||
-rw-r--r-- | Plugins/gol.c | 89 | ||||
-rw-r--r-- | Plugins/gol.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/gol.exp | bin | 0 -> 567 bytes | |||
-rw-r--r-- | Plugins/gol.lib | bin | 0 -> 1908 bytes | |||
-rw-r--r-- | Plugins/gol.obj | bin | 0 -> 1878 bytes | |||
-rw-r--r-- | Plugins/green.cpp | 14 | ||||
-rw-r--r-- | Plugins/green.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/green.exp | bin | 0 -> 619 bytes | |||
-rw-r--r-- | Plugins/green.lib | bin | 0 -> 2042 bytes | |||
-rw-r--r-- | Plugins/green.obj | bin | 0 -> 849 bytes | |||
-rw-r--r-- | Plugins/hist.cpp | 54 | ||||
-rw-r--r-- | Plugins/hist.dll | bin | 0 -> 45056 bytes | |||
-rw-r--r-- | Plugins/hist.exp | bin | 0 -> 614 bytes | |||
-rw-r--r-- | Plugins/hist.lib | bin | 0 -> 2032 bytes | |||
-rw-r--r-- | Plugins/hist.obj | bin | 0 -> 1986 bytes | |||
-rw-r--r-- | Plugins/makefile | 82 | ||||
-rw-r--r-- | Plugins/makesliders.c | 40 | ||||
-rw-r--r-- | Plugins/makesliders.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/makesliders.exp | bin | 0 -> 599 bytes | |||
-rw-r--r-- | Plugins/makesliders.lib | bin | 0 -> 2004 bytes | |||
-rw-r--r-- | Plugins/makesliders.obj | bin | 0 -> 940 bytes | |||
-rw-r--r-- | Plugins/ms.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/noize.c | 21 | ||||
-rw-r--r-- | Plugins/noize.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/noize.exp | bin | 0 -> 700 bytes | |||
-rw-r--r-- | Plugins/noize.lib | bin | 0 -> 2120 bytes | |||
-rw-r--r-- | Plugins/noize.obj | bin | 0 -> 865 bytes | |||
-rw-r--r-- | Plugins/pixels.h | 117 | ||||
-rw-r--r-- | Plugins/plot.cpp | 25 | ||||
-rw-r--r-- | Plugins/plot.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/plot.exp | bin | 0 -> 614 bytes | |||
-rw-r--r-- | Plugins/plot.lib | bin | 0 -> 2032 bytes | |||
-rw-r--r-- | Plugins/plot.obj | bin | 0 -> 1011 bytes | |||
-rw-r--r-- | Plugins/plugin.h | 119 | ||||
-rw-r--r-- | Plugins/rgb.c | 62 | ||||
-rw-r--r-- | Plugins/rgb.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/rgb.exp | bin | 0 -> 567 bytes | |||
-rw-r--r-- | Plugins/rgb.lib | bin | 0 -> 1908 bytes | |||
-rw-r--r-- | Plugins/rgb.obj | bin | 0 -> 1180 bytes | |||
-rw-r--r-- | Plugins/rgbcopy.cpp | 28 | ||||
-rw-r--r-- | Plugins/rgbcopy.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/rgbcopy.exp | bin | 0 -> 621 bytes | |||
-rw-r--r-- | Plugins/rgbcopy.lib | bin | 0 -> 2062 bytes | |||
-rw-r--r-- | Plugins/rgbcopy.obj | bin | 0 -> 1884 bytes | |||
-rw-r--r-- | Plugins/setbits.c | 11 | ||||
-rw-r--r-- | Plugins/setbits.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/setbits.exp | bin | 0 -> 583 bytes | |||
-rw-r--r-- | Plugins/setbits.lib | bin | 0 -> 1956 bytes | |||
-rw-r--r-- | Plugins/setbits.obj | bin | 0 -> 514 bytes | |||
-rw-r--r-- | Plugins/sharemem.h | 61 | ||||
-rw-r--r-- | Plugins/shuffle.c | 42 | ||||
-rw-r--r-- | Plugins/shuffle.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/shuffle.exp | bin | 0 -> 583 bytes | |||
-rw-r--r-- | Plugins/shuffle.lib | bin | 0 -> 1956 bytes | |||
-rw-r--r-- | Plugins/shuffle.obj | bin | 0 -> 1020 bytes | |||
-rw-r--r-- | Plugins/sonogram.cpp | 82 | ||||
-rw-r--r-- | Plugins/sonogram.dll | bin | 0 -> 45056 bytes | |||
-rw-r--r-- | Plugins/sonogram.exp | bin | 0 -> 630 bytes | |||
-rw-r--r-- | Plugins/sonogram.lib | bin | 0 -> 2080 bytes | |||
-rw-r--r-- | Plugins/sonogram.obj | bin | 0 -> 2306 bytes | |||
-rw-r--r-- | Plugins/subtract.cpp | 38 | ||||
-rw-r--r-- | Plugins/subtract.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/subtract.exp | bin | 0 -> 630 bytes | |||
-rw-r--r-- | Plugins/subtract.lib | bin | 0 -> 2080 bytes | |||
-rw-r--r-- | Plugins/subtract.obj | bin | 0 -> 1409 bytes | |||
-rw-r--r-- | Plugins/swap.cpp | 62 | ||||
-rw-r--r-- | Plugins/swap.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/swap.exp | bin | 0 -> 608 bytes | |||
-rw-r--r-- | Plugins/swap.lib | bin | 0 -> 2026 bytes | |||
-rw-r--r-- | Plugins/swap.obj | bin | 0 -> 1893 bytes | |||
-rw-r--r-- | Plugins/tile.cpp | 59 | ||||
-rw-r--r-- | Plugins/tile.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/tile.exp | bin | 0 -> 608 bytes | |||
-rw-r--r-- | Plugins/tile.lib | bin | 0 -> 2026 bytes | |||
-rw-r--r-- | Plugins/tile.obj | bin | 0 -> 1312 bytes | |||
-rw-r--r-- | Plugins/vf2fs.c | 49 | ||||
-rw-r--r-- | Plugins/vf2fs.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/vf2fs.exp | bin | 0 -> 575 bytes | |||
-rw-r--r-- | Plugins/vf2fs.lib | bin | 0 -> 1932 bytes | |||
-rw-r--r-- | Plugins/vf2fs.obj | bin | 0 -> 1894 bytes | |||
-rw-r--r-- | Plugins/xbend.c | 99 | ||||
-rw-r--r-- | Plugins/xbend.dll | bin | 0 -> 36864 bytes | |||
-rw-r--r-- | Plugins/xbend.exp | bin | 0 -> 700 bytes | |||
-rw-r--r-- | Plugins/xbend.lib | bin | 0 -> 2120 bytes | |||
-rw-r--r-- | Plugins/xbend.obj | bin | 0 -> 1832 bytes | |||
-rw-r--r-- | Plugins/xshred.c | 20 | ||||
-rw-r--r-- | Plugins/xshred.dll | bin | 0 -> 28672 bytes | |||
-rw-r--r-- | Plugins/xshred.exp | bin | 0 -> 570 bytes | |||
-rw-r--r-- | Plugins/xshred.lib | bin | 0 -> 1936 bytes | |||
-rw-r--r-- | Plugins/xshred.obj | bin | 0 -> 640 bytes |
121 files changed, 1454 insertions, 0 deletions
diff --git a/Plugins/2colors.cpp b/Plugins/2colors.cpp new file mode 100644 index 0000000..b76be62 --- /dev/null +++ b/Plugins/2colors.cpp @@ -0,0 +1,21 @@ +#include <stdlib.h> +#include "plugin.h" +#include "pixels.h" + +// 2colors: make the image consist of black and white pixels only. +// I haven't tested this yet and it most likely WILL NOT WORK!!! + +void perform_effect(_frame f, _args a) +{ + pixels p(f); + int i=127, o; // intensity + + if(a.s) i=atoi(a.s); + + while(!p.eof()) + { + o = (p.red() + p.green() + p.blue()) / 3; + if(i<o) p.putrgb(0, 0, 0); else p.putrgb(255, 255, 255); + p.next(); + } +} diff --git a/Plugins/2colors.dll b/Plugins/2colors.dll Binary files differnew file mode 100644 index 0000000..ba62b0f --- /dev/null +++ b/Plugins/2colors.dll diff --git a/Plugins/2colors.exp b/Plugins/2colors.exp Binary files differnew file mode 100644 index 0000000..a0e870b --- /dev/null +++ b/Plugins/2colors.exp diff --git a/Plugins/2colors.lib b/Plugins/2colors.lib Binary files differnew file mode 100644 index 0000000..38cf84a --- /dev/null +++ b/Plugins/2colors.lib diff --git a/Plugins/2colors.obj b/Plugins/2colors.obj Binary files differnew file mode 100644 index 0000000..2013b69 --- /dev/null +++ b/Plugins/2colors.obj diff --git a/Plugins/README.txt b/Plugins/README.txt new file mode 100644 index 0000000..893a4ad --- /dev/null +++ b/Plugins/README.txt @@ -0,0 +1,12 @@ +Put your dlls with proper exported perform-functions here, and Framestein +will load them on startup. + +Read plugin.h and noize.c and try example-plugins.pd for the whole story. +Pixels.h and green.cpp or tile.cpp demonstrate the easy-to-use pixels-class. + +If you write plugins please contribute them to the Framestein distribution. + +(type "make" to build plugins in this directory with MS Visual C++.) + +NOTE: I'm distributing my Plugins-directory as-is, some of them are +feature-incomplete. 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 <stdlib.h> +#include <string.h> +#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<f2.width ? f1.width : f2.width; + h = f1.height<f2.height ? f1.height : f2.height; + + if(pos<0) pos=0; + if(pos>=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<h; y++) + { + p1 = scanline(f1, y); + p2 = scanline(f2, y); + for(x=0; x<w; x++) + { + if(!tp) + { + memcpy(&p2[x*pixelsize], x<pos||pos-(x-pos)<0 ? &p1[x*pixelsize] + : &p1[(pos-(x-pos))*pixelsize], pixelsize); + } else + { + src = x<pos ? x/(float)pos*pos2 + : pos2+((x-pos)/(float)widthminuspos*widthminuspos2); + + if(!tpy) { + memcpy(&p2[x*pixelsize], &p1[src*pixelsize], pixelsize); + } else { + ysrc = y<ypos1 ? y/(float)ypos1*ypos2 + : ypos2+((y-ypos1)/(float)heightminusypos1*heightminusypos2); + + memcpy(&p2[x*pixelsize], &scanline(f1, ysrc)[src*pixelsize], + pixelsize); + } + } + } + } +} diff --git a/Plugins/bend.dll b/Plugins/bend.dll Binary files differnew file mode 100644 index 0000000..220d616 --- /dev/null +++ b/Plugins/bend.dll diff --git a/Plugins/bend.exp b/Plugins/bend.exp Binary files differnew file mode 100644 index 0000000..6f7f43a --- /dev/null +++ b/Plugins/bend.exp diff --git a/Plugins/bend.lib b/Plugins/bend.lib Binary files differnew file mode 100644 index 0000000..ebb3f95 --- /dev/null +++ b/Plugins/bend.lib diff --git a/Plugins/bend.obj b/Plugins/bend.obj Binary files differnew file mode 100644 index 0000000..3ac109f --- /dev/null +++ b/Plugins/bend.obj diff --git a/Plugins/black.c b/Plugins/black.c new file mode 100644 index 0000000..3716767 --- /dev/null +++ b/Plugins/black.c @@ -0,0 +1,13 @@ +#include <stdlib.h> +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + memset(f.bits, 0, f.height*f.lpitch); +} + +void perform_copy(_frame f1, _frame f2, _args a) +{ + memset(f1.bits, 0, f1.height*f1.lpitch); + memset(f2.bits, 0, f2.height*f2.lpitch); +} diff --git a/Plugins/black.dll b/Plugins/black.dll Binary files differnew file mode 100644 index 0000000..cb8b57a --- /dev/null +++ b/Plugins/black.dll diff --git a/Plugins/black.exp b/Plugins/black.exp Binary files differnew file mode 100644 index 0000000..4399f54 --- /dev/null +++ b/Plugins/black.exp diff --git a/Plugins/black.lib b/Plugins/black.lib Binary files differnew file mode 100644 index 0000000..a21da90 --- /dev/null +++ b/Plugins/black.lib diff --git a/Plugins/black.obj b/Plugins/black.obj Binary files differnew file mode 100644 index 0000000..45e140d --- /dev/null +++ b/Plugins/black.obj diff --git a/Plugins/colortv.c b/Plugins/colortv.c new file mode 100644 index 0000000..1885d1f --- /dev/null +++ b/Plugins/colortv.c @@ -0,0 +1,69 @@ +#include "plugin.h" + +void perform_effect(struct frame f, struct args a) +{ + int x, y; + pixel16 *p16; + pixel32 *p32; + pixel16 c1, c2, c3; + + switch(f.pixelformat) + { + case 16: + for(y=0; y<f.height; y++) + { + p16=scanline16(f, y); + for(x=1; x<f.width; x++) + { + p16[x]=(p16[x]+p16[x-1])/2; + } + } + break; + case 32: + for(y=0; y<f.height; y++) + { + p32=scanline32(f, y); + for(x=1; x<f.width; x++) + { + p32[x]=(p32[x]+p32[x-1])/2; + } + } + break; + } +} + +void perform_copy(struct frame f1, struct frame f2, struct args a) +{ + int x, y, w, h; + pixel16 *p1_16, *p2_16, c1, c2, c3; + pixel32 *p1_32, *p2_32; + + w = f1.width<f2.width ? f1.width : f2.width; + h = f1.height<f2.height ? f1.height : f2.height; + + switch(f1.pixelformat) + { + case 16: + for(y=0; y<h; y++) + { + p1_16 = scanline16(f1, y); + p2_16 = scanline16(f2, y); + for(x=1; x<w; x++) + { + p2_16[x]=(p1_16[x]+p2_16[x])/2; + } + } + break; + case 32: + for(y=0; y<h; y++) + { + p1_32 = scanline32(f1, y); + p2_32 = scanline32(f2, y); + for(x=1; x<w; x++) + { + p2_32[x]=(p1_32[x]+p2_32[x])/2; + } + } + break; + } +} diff --git a/Plugins/colortv.dll b/Plugins/colortv.dll Binary files differnew file mode 100644 index 0000000..cf5dacf --- /dev/null +++ b/Plugins/colortv.dll diff --git a/Plugins/colortv.exp b/Plugins/colortv.exp Binary files differnew file mode 100644 index 0000000..53c82e7 --- /dev/null +++ b/Plugins/colortv.exp diff --git a/Plugins/colortv.lib b/Plugins/colortv.lib Binary files differnew file mode 100644 index 0000000..f08d5a3 --- /dev/null +++ b/Plugins/colortv.lib diff --git a/Plugins/colortv.obj b/Plugins/colortv.obj Binary files differnew file mode 100644 index 0000000..dcb2aa3 --- /dev/null +++ b/Plugins/colortv.obj 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); +} diff --git a/Plugins/copy_vert.dll b/Plugins/copy_vert.dll Binary files differnew file mode 100644 index 0000000..95aab74 --- /dev/null +++ b/Plugins/copy_vert.dll diff --git a/Plugins/copy_vert.exp b/Plugins/copy_vert.exp Binary files differnew file mode 100644 index 0000000..d7f0589 --- /dev/null +++ b/Plugins/copy_vert.exp diff --git a/Plugins/copy_vert.lib b/Plugins/copy_vert.lib Binary files differnew file mode 100644 index 0000000..790bae5 --- /dev/null +++ b/Plugins/copy_vert.lib diff --git a/Plugins/copy_vert.obj b/Plugins/copy_vert.obj Binary files differnew file mode 100644 index 0000000..543c39f --- /dev/null +++ b/Plugins/copy_vert.obj diff --git a/Plugins/fs2vf.c b/Plugins/fs2vf.c new file mode 100644 index 0000000..3d1d4bc --- /dev/null +++ b/Plugins/fs2vf.c @@ -0,0 +1,49 @@ +// +// writevf.c +// put image data to vframe +// +// 1st argument is name of shared memory +// to struct vframeimage (see Externals\vframe.h) +// + +#include <memory.h> +#include "plugin.h" +#include "sharemem.h" +#include "vframe.h" + +void perform_effect(_frame f, _args a) +{ + HANDLE hlvframe=NULL, hl=NULL; + LPVOID p=NULL; + struct vframeimage *vfp=NULL; + unsigned long c; + + if(!a.s) return; + + vfp = (struct vframeimage *)smopen(&hlvframe, a.s); + if(vfp==NULL) return; + +// printf("name %s width %d height %d pf %d bits %s\n", +// a.s, vfp->f.width, vfp->f.height, vfp->f.pixelformat, vfp->bitsname); + + if(f.pixelformat != vfp->f.pixelformat) + { + printf("fs2vf: pixelformats are different. no resampling available.\n"); + return; + } + + p = smopen(&hl, vfp->bitsname); + if(p==NULL) + { + CloseHandle(hlvframe); + return; + } + + c = (f.height*f.lpitch < vfp->f.height*vfp->f.lpitch) ? + f.height*f.lpitch : vfp->f.height*vfp->f.lpitch; + + memcpy(p, f.bits, c); + + smfree(&hl, p); + smfree(&hlvframe, vfp); +} diff --git a/Plugins/fs2vf.dll b/Plugins/fs2vf.dll Binary files differnew file mode 100644 index 0000000..974de86 --- /dev/null +++ b/Plugins/fs2vf.dll diff --git a/Plugins/fs2vf.exp b/Plugins/fs2vf.exp Binary files differnew file mode 100644 index 0000000..f3d5fba --- /dev/null +++ b/Plugins/fs2vf.exp diff --git a/Plugins/fs2vf.lib b/Plugins/fs2vf.lib Binary files differnew file mode 100644 index 0000000..038bb12 --- /dev/null +++ b/Plugins/fs2vf.lib diff --git a/Plugins/fs2vf.obj b/Plugins/fs2vf.obj Binary files differnew file mode 100644 index 0000000..4996274 --- /dev/null +++ b/Plugins/fs2vf.obj diff --git a/Plugins/gol.c b/Plugins/gol.c new file mode 100644 index 0000000..89ff284 --- /dev/null +++ b/Plugins/gol.c @@ -0,0 +1,89 @@ + +// +// Game of Life .. what a waste of time +// + +#include <stdlib.h> +#include <stdio.h> +#include "plugin.h" + +#define BORN 1 +#define DYING 2 + +int dead = 0; + +int aroundme(_frame f, int x, int y) +{ + int i=0; + if(r16(scanline16(f, y-1)[x-1])>dead) i++; + if(r16(scanline16(f, y-1)[x])>dead) i++; + if(r16(scanline16(f, y-1)[x+1])>dead) i++; + if(r16(scanline16(f, y)[x-1])>dead) i++; + if(r16(scanline16(f, y)[x+1])>dead) i++; + if(r16(scanline16(f, y+1)[x-1])>dead) i++; + if(r16(scanline16(f, y+1)[x])>dead) i++; + if(r16(scanline16(f, y+1)[x+1])>dead) i++; + return i; +} + +void setstate(_frame f, byte *t, int x, int y) +{ + int i = aroundme(f, x, y); + + if(i<=1 || i>=4) t[y*f.width+x]=DYING; + else + if(i==3) t[y*f.width+x]=BORN; +} + +void perform_effect(struct frame f, struct args a) +{ + int x,y,i,r; + pixel16 *p, c; + byte *t; + + if(f.pixelformat!=16) return; + + t = malloc(f.width*f.height); + memset(t, 0, f.width*f.height); + + for(y=2; y<f.height-3; y++) + { + p = scanline16(f, y); + for(x=2; x<f.width-3; x++) + { + if(r16(p[x])>0) + { + setstate(f, t, x-1, y-1); + setstate(f, t, x, y-1); + setstate(f, t, x+1, y-1); + setstate(f, t, x-1, y); + setstate(f, t, x, y); + setstate(f, t, x+1, y); + setstate(f, t, x-1, y+1); + setstate(f, t, x, y+1); + setstate(f, t, x+1, y+1); + } + } + } + + for(y=2; y<f.height-3; y++) + { + p = scanline16(f, y); + for(x=2; x<f.width-3; x++) + { + switch(t[y*f.width+x]) + { + case BORN: + c = p[x]; + r = r16(c); + p[x] = rgbtocolor16(r>0 ? r : 255, g16(c), b16(c)); + break; + case DYING: + c = p[+x]; + p[x] = rgbtocolor16(0, g16(c), b16(c)); + break; + } + } + } + free(t); +} diff --git a/Plugins/gol.dll b/Plugins/gol.dll Binary files differnew file mode 100644 index 0000000..dfd2fd6 --- /dev/null +++ b/Plugins/gol.dll diff --git a/Plugins/gol.exp b/Plugins/gol.exp Binary files differnew file mode 100644 index 0000000..2dcf523 --- /dev/null +++ b/Plugins/gol.exp diff --git a/Plugins/gol.lib b/Plugins/gol.lib Binary files differnew file mode 100644 index 0000000..c38fb4e --- /dev/null +++ b/Plugins/gol.lib diff --git a/Plugins/gol.obj b/Plugins/gol.obj Binary files differnew file mode 100644 index 0000000..e571ee0 --- /dev/null +++ b/Plugins/gol.obj diff --git a/Plugins/green.cpp b/Plugins/green.cpp new file mode 100644 index 0000000..c66e3e6 --- /dev/null +++ b/Plugins/green.cpp @@ -0,0 +1,14 @@ +// this is just an example of using the pixels-class.. + +#include "plugin.h" +#include "pixels.h" + +void perform_effect(_frame f, _args a) +{ + pixels p(f); + while(!p.eof()) + { + p.putrgb(0, p.green(), 0); + p.next(); + } +} diff --git a/Plugins/green.dll b/Plugins/green.dll Binary files differnew file mode 100644 index 0000000..3dc1016 --- /dev/null +++ b/Plugins/green.dll diff --git a/Plugins/green.exp b/Plugins/green.exp Binary files differnew file mode 100644 index 0000000..bba3425 --- /dev/null +++ b/Plugins/green.exp diff --git a/Plugins/green.lib b/Plugins/green.lib Binary files differnew file mode 100644 index 0000000..f79b6b6 --- /dev/null +++ b/Plugins/green.lib diff --git a/Plugins/green.obj b/Plugins/green.obj Binary files differnew file mode 100644 index 0000000..d32d5ab --- /dev/null +++ b/Plugins/green.obj diff --git a/Plugins/hist.cpp b/Plugins/hist.cpp new file mode 100644 index 0000000..f525db1 --- /dev/null +++ b/Plugins/hist.cpp @@ -0,0 +1,54 @@ +// +// build an array where x=color intensity and y=number of colors with that intensity. +// use with fs.hist.pd. +// +// array is passed in a file, a better solution would be to use vframe... +// + +#include <stdlib.h> +#include <stdio.h> +#include <iostream.h> +#include <fstream.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +void perform_effect(_frame f, _args a) +{ + if(!a.s) return; + + // parameters: <color> <filename for output> <pd receivename to bang> + // get gol + byte col = atoi(a.s); + + // get filename + char *t; + if(!(t = strstr(a.s, " "))) return; + char *filename = t+1; + + // get receivename + if(!(t = strstr(t+1, " "))) return; + char *retname = t+1; + t[0]=0; // tell filename and receivename apart + + pixels p(f); + signed short hist[256]; // 16bits, for read16 on pd + +// count colors from zero up + memset(hist, 0, sizeof(hist)); +// or count from -2^15 (bottom of graph)? +// short i, v=1<<15; +// for(i=0; i<256; hist[i++]=v) ; + + while(!p.eof()) + { + ++hist[col==0 ? p.red() : col==1 ? p.green() : col==2 ? p.blue() : 0]; + p.next(); + } + + ofstream of(filename, ios::out|ios::binary); + of.write((char *)&hist, sizeof(hist)); + of.close(); + + sprintf(a.ret, "%s=1", retname); // bang to indicate we're done +} diff --git a/Plugins/hist.dll b/Plugins/hist.dll Binary files differnew file mode 100644 index 0000000..7c0bc44 --- /dev/null +++ b/Plugins/hist.dll diff --git a/Plugins/hist.exp b/Plugins/hist.exp Binary files differnew file mode 100644 index 0000000..238ffc2 --- /dev/null +++ b/Plugins/hist.exp diff --git a/Plugins/hist.lib b/Plugins/hist.lib Binary files differnew file mode 100644 index 0000000..d8d0ddc --- /dev/null +++ b/Plugins/hist.lib diff --git a/Plugins/hist.obj b/Plugins/hist.obj Binary files differnew file mode 100644 index 0000000..760936d --- /dev/null +++ b/Plugins/hist.obj diff --git a/Plugins/makefile b/Plugins/makefile new file mode 100644 index 0000000..e899fe2 --- /dev/null +++ b/Plugins/makefile @@ -0,0 +1,82 @@ +all: noize colortv subtract xbend bend gol shuffle green tile rgbcopy copyvert black rgb hist setbits xshred sonogram vf2fs fs2vf swap 2colors plot makesliders + dir *.dll + +# FLAGS: +# +# <opts!!!> + +FLAGS = /LD /Gd /GD /Ox + +EFFECT = /export:perform_effect +COPY = /export:perform_copy +BOTH = /export:perform_effect /export:perform_copy + +noize: + cl noize.c $(FLAGS) /link $(BOTH) + +colortv: + cl colortv.c $(FLAGS) /link $(BOTH) + +subtract: + cl subtract.cpp $(FLAGS) /link $(EFFECT) + +xbend: + cl xbend.c $(FLAGS) /link $(BOTH) + +bend: + cl bend.c $(FLAGS) /link $(BOTH) + +gol: + cl gol.c $(FLAGS) /link $(EFFECT) + +shuffle: + cl shuffle.c $(FLAGS) /link $(EFFECT) + +green: + cl green.cpp $(FLAGS) /link $(EFFECT) + +tile: + cl tile.cpp $(FLAGS) /link $(COPY) + +rgbcopy: + cl rgbcopy.cpp $(FLAGS) /link $(COPY) + +copyvert: + cl copy_vert.c $(FLAGS) /link $(COPY) + +black: + cl black.c $(FLAGS) /link $(BOTH) + +rgb: + cl rgb.c $(FLAGS) /link $(EFFECT) + +hist: + cl hist.cpp $(FLAGS) /link $(EFFECT) + +setbits: + cl setbits.c $(FLAGS) /link $(EFFECT) + +sonogram: + cl sonogram.cpp $(FLAGS) /link $(EFFECT) + +xshred: + cl xshred.c $(FLAGS) /link $(COPY) + +vf2fs: + cl vf2fs.c $(FLAGS) /I..\Externals /link $(EFFECT) + +fs2vf: + cl fs2vf.c $(FLAGS) /I..\Externals /link $(EFFECT) + +swap: + cl swap.cpp $(FLAGS) /link $(COPY) + +2colors: + cl 2colors.cpp $(FLAGS) /link $(EFFECT) + +plot: + cl plot.cpp $(FLAGS) /link $(EFFECT) + +makesliders: + cl makesliders.c $(FLAGS) /link $(EFFECT) + copy makesliders.dll ms.dll 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); + } + } +} diff --git a/Plugins/makesliders.dll b/Plugins/makesliders.dll Binary files differnew file mode 100644 index 0000000..5491ab8 --- /dev/null +++ b/Plugins/makesliders.dll diff --git a/Plugins/makesliders.exp b/Plugins/makesliders.exp Binary files differnew file mode 100644 index 0000000..307b3d6 --- /dev/null +++ b/Plugins/makesliders.exp diff --git a/Plugins/makesliders.lib b/Plugins/makesliders.lib Binary files differnew file mode 100644 index 0000000..40bd42c --- /dev/null +++ b/Plugins/makesliders.lib diff --git a/Plugins/makesliders.obj b/Plugins/makesliders.obj Binary files differnew file mode 100644 index 0000000..c7326db --- /dev/null +++ b/Plugins/makesliders.obj diff --git a/Plugins/ms.dll b/Plugins/ms.dll Binary files differnew file mode 100644 index 0000000..5491ab8 --- /dev/null +++ b/Plugins/ms.dll diff --git a/Plugins/noize.c b/Plugins/noize.c new file mode 100644 index 0000000..d6d2b3a --- /dev/null +++ b/Plugins/noize.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include "plugin.h" + +void perform_effect(struct frame f, struct args a) +{ + int i,o,x,y; + byte bits = f.pixelformat/8; + + o=(f.width*f.height)/10; + for(i=0; i<o; i++) + { + x=rand()%(f.width); + y=rand()%(f.height); + f.bits[y*f.lpitch+x*bits+1]=rand()%(256); + } +} + +void perform_copy(struct frame f1, struct frame f2, struct args a) +{ + printf("Using noize as copy operation does nothing!\n"); +} diff --git a/Plugins/noize.dll b/Plugins/noize.dll Binary files differnew file mode 100644 index 0000000..b761095 --- /dev/null +++ b/Plugins/noize.dll diff --git a/Plugins/noize.exp b/Plugins/noize.exp Binary files differnew file mode 100644 index 0000000..489c203 --- /dev/null +++ b/Plugins/noize.exp diff --git a/Plugins/noize.lib b/Plugins/noize.lib Binary files differnew file mode 100644 index 0000000..cbdfba5 --- /dev/null +++ b/Plugins/noize.lib diff --git a/Plugins/noize.obj b/Plugins/noize.obj Binary files differnew file mode 100644 index 0000000..302298a --- /dev/null +++ b/Plugins/noize.obj diff --git a/Plugins/pixels.h b/Plugins/pixels.h new file mode 100644 index 0000000..4dd1264 --- /dev/null +++ b/Plugins/pixels.h @@ -0,0 +1,117 @@ +// Easy iteration thru pixels, see green.cpp and tile.cpp for examples +// NOTE: using this class could be a bit slower than manipulating the bits directly.. +// +// changes to 0.20 +// - pixelformat-aware functions red() green() blue() and putrgb() +// - dot16() dot24() and dot32() added +// - get/put dot() removed, use above + +#include "plugin.h" + +#ifndef _PIXELSH +#define _PIXELSH + +class pixels +{ +private: + _frame m_f; + pixel8 *p8; // pointer to a row of 8-bit pixels + pixel16 *p16; + pixel24 *p24; + pixel32 *p32; + + __inline void updaterowp(); +public: + int x, y; + + pixels(const _frame &f) + { + m_f = f; + x = -1; + y = 0; + p8 = 0; + next(); + } + + __inline pixel8 dot8() { return p8[x]; } + __inline pixel16 dot16() { return p16[x]; } + __inline pixel24 dot24() { return p24[x]; } + __inline pixel32 dot32() { return p32[x]; } + + __inline void dot8(pixel8 c) { p8[x] = c; } + __inline void dot16(pixel16 c) { p16[x] = c; } + __inline void dot24(pixel24 c) { p24[x] = c; } + __inline void dot32(pixel32 c) { p32[x] = c; } + + __inline byte red(); + __inline byte green(); + __inline byte blue(); + + __inline void putrgb(byte r, byte g, byte b); + + __inline void moveto(int tox, int toy) + { if(tox<m_f.width) x=tox; if(toy<m_f.height) { y=toy; updaterowp(); } } + + __inline int eof() { return y==m_f.height ? 1 : 0; } + void next(); +}; + +byte pixels::red() +{ + switch(m_f.pixelformat) + { + case 16: return r16(p16[x]); + case 24: return r24(p24[x]); + case 32: return r32(p32[x]); + default: return 0; + } +} + +byte pixels::green() +{ + switch(m_f.pixelformat) + { + case 16: return g16(p16[x]); + case 24: return g24(p24[x]); + case 32: return g32(p32[x]); + default: return 0; + } +} + +byte pixels::blue() +{ + switch(m_f.pixelformat) + { + case 16: return b16(p16[x]); + case 24: return b24(p24[x]); + case 32: return b32(p32[x]); + default: return 0; + } +} + +void pixels::putrgb(byte r, byte g, byte b) +{ + switch(m_f.pixelformat) + { + case 16: p16[x] = rgbtocolor16(r, g, b); break; + case 24: p24[x] = rgbtocolor24(r, g, b); break; + case 32: p32[x] = rgbtocolor32(r, g, b); break; + } +} + +void pixels::next() +{ + x++; + if(x==m_f.width) { y++; x=0; p8=0; } + if(!p8) updaterowp(); +} + +void pixels::updaterowp() +{ + p8 = scanline(m_f, y); + p16 = (pixel16 *)p8; + p24 = (pixel24 *)p8; + p32 = (pixel32 *)p8; +} + +#endif // #ifndef _PIXELSH diff --git a/Plugins/plot.cpp b/Plugins/plot.cpp new file mode 100644 index 0000000..67c264c --- /dev/null +++ b/Plugins/plot.cpp @@ -0,0 +1,25 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +// plot exists to provide plotting to vframe - much faster than +// plot with fs.draw which goes thru network. + +void perform_effect(_frame f, _args a) +{ + if(!a.s) return; + + char *t=strstr(a.s, " "); + if(!t) return; + + t[0]=0; + + int x=atoi(a.s); + int y=atoi(t+1); + + pixels p(f); + p.moveto(x, y); + p.putrgb(255, 255, 255); +} diff --git a/Plugins/plot.dll b/Plugins/plot.dll Binary files differnew file mode 100644 index 0000000..93cff6a --- /dev/null +++ b/Plugins/plot.dll diff --git a/Plugins/plot.exp b/Plugins/plot.exp Binary files differnew file mode 100644 index 0000000..1d5ce2f --- /dev/null +++ b/Plugins/plot.exp diff --git a/Plugins/plot.lib b/Plugins/plot.lib Binary files differnew file mode 100644 index 0000000..afdc085 --- /dev/null +++ b/Plugins/plot.lib diff --git a/Plugins/plot.obj b/Plugins/plot.obj Binary files differnew file mode 100644 index 0000000..c48c30f --- /dev/null +++ b/Plugins/plot.obj diff --git a/Plugins/plugin.h b/Plugins/plugin.h new file mode 100644 index 0000000..00d3514 --- /dev/null +++ b/Plugins/plugin.h @@ -0,0 +1,119 @@ +// +// send the name of the plugin to fs.frame, and fs will call +// perform_effect(struct frame f, struct args a) in your dll. +// +// send it to the right inlet of fs.copy, and +// perform_copy(struct frame f1, struct frame f2, struct args a) +// will be used as a copy operation. +// + +#ifndef _PLUGINH +#define _PLUGINH + +typedef unsigned char byte; +#define pixel8 byte +#define pixel16 unsigned short +#define pixel24 struct pixel24data +#define pixel32 unsigned long +#define _frame struct frame +#define _args struct args + +struct pixel24data { byte b; byte g; byte r; }; + +struct frame +{ + byte *bits; // pixel data + int lpitch; // used to get row position in bits, see scanline below + // this is not always width*(pixelformat/8), you tell me why + int width; + int height; + int pixelformat; // pixelformat is bitcount of your screen, 8, 16, 24 or 32. +}; + +struct args +{ + char *s; // effect/copy arguments in a string + char *ret; // return values. data given in the form + // "pd_receive_name=value;..." will be sent back to Pd. + // memory allocated: 256 characters. +}; + +// 8-bit pointer to row y +__inline byte *scanline(struct frame f, int y) { return &f.bits[y*f.lpitch]; } + +// pointer to 16 bit pixels +__inline pixel16 *scanline16(struct frame f, int y) { return (pixel16 *)scanline(f, y); } + +// pointer to 24 bit pixels +__inline pixel24 *scanline24(struct frame f, int y) { return (pixel24 *)scanline(f, y); } + +// pointer to 32 bit pixels +__inline pixel32 *scanline32(struct frame f, int y) { return (pixel32 *)scanline(f, y); } + +__inline byte r16(pixel16 color) +{ + return (color >> 11) << 3; +} + +__inline byte g16(pixel16 color) +{ + return ((color & 2016) >> 5) << 2; +} + +__inline byte b16(pixel16 color) +{ + return (color & 31) << 3; +} + +__inline byte r24(pixel24 color) +{ + return color.r; +} + +__inline byte g24(pixel24 color) +{ + return color.g; +} + +__inline byte b24(pixel24 color) +{ + return color.b; +} + +__inline byte r32(pixel32 color) +{ + return (byte)color; +} + +__inline byte g32(pixel32 color) +{ + return (byte)(((pixel16)color) >> 8); +} + +__inline byte b32(pixel32 color) +{ + return (byte)(color >> 16); +} + +__inline pixel16 rgbtocolor16(byte r, byte g, byte b) +{ + return ((r >> 3) << 11) | // r value shifted + ((g >> 2) << 5) | // g value shifted + (b >> 3); // add blue +} + +__inline pixel24 rgbtocolor24(byte r, byte g, byte b) +{ + pixel24 p; + p.r = r; + p.g = g; + p.b = b; + return p; +} + +__inline pixel32 rgbtocolor32(byte r, byte g, byte b) +{ + return (b << 16) | (g << 8) | r; +} + +#endif // #ifndef _PLUGINH diff --git a/Plugins/rgb.c b/Plugins/rgb.c new file mode 100644 index 0000000..d58f784 --- /dev/null +++ b/Plugins/rgb.c @@ -0,0 +1,62 @@ +#include <string.h> +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + char *t; + short x, y; + pixel16 c16; + pixel24 c24; + pixel32 c32; + byte r, g, b; + char *ret_r, *ret_g, *ret_b; + + if(!a.s) return; + + // get x and y params + x = atoi(a.s); + if(!(t = strstr(a.s, " "))) return; + y = atoi(t+1); + + // get returnvaluereceivenames + if(!(t = strstr(t+1, " "))) return; + ret_r = t+1; + if(!(t = strstr(t+1, " "))) return; + ret_g = t+1; + t[0]=0; + if(!(t = strstr(t+1, " "))) return; + ret_b = t+1; + t[0]=0; + + if(x<0||x>=f.width) return; + if(y<0||y>=f.height) return; + + switch(f.pixelformat) + { + case 16: + c16 = scanline16(f, y)[x]; + r = r16(c16); + g = g16(c16); + b = b16(c16); + break; + case 24: + c24 = scanline24(f, y)[x]; + r = r24(c24); + g = g24(c24); + b = b24(c24); + break; + case 32: + c32 = scanline32(f, y)[x]; + r = r32(c32); + g = g32(c32); + b = b32(c32); + break; + } + + // return-values: + // + // framestein will send data given in the form "pd_receiver_name=value" + // back to pd. + + sprintf(a.ret, "%s=%d;%s=%d;%s=%d", ret_b, b, ret_g, g, ret_r, r); +} diff --git a/Plugins/rgb.dll b/Plugins/rgb.dll Binary files differnew file mode 100644 index 0000000..ba7dfd2 --- /dev/null +++ b/Plugins/rgb.dll diff --git a/Plugins/rgb.exp b/Plugins/rgb.exp Binary files differnew file mode 100644 index 0000000..cc7feab --- /dev/null +++ b/Plugins/rgb.exp diff --git a/Plugins/rgb.lib b/Plugins/rgb.lib Binary files differnew file mode 100644 index 0000000..8e364a1 --- /dev/null +++ b/Plugins/rgb.lib diff --git a/Plugins/rgb.obj b/Plugins/rgb.obj Binary files differnew file mode 100644 index 0000000..69b7892 --- /dev/null +++ b/Plugins/rgb.obj diff --git a/Plugins/rgbcopy.cpp b/Plugins/rgbcopy.cpp new file mode 100644 index 0000000..b226e23 --- /dev/null +++ b/Plugins/rgbcopy.cpp @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +void perform_copy(_frame f1, _frame f2, _args a) +{ + pixels p1(f1), p2(f2); + char *t; + short r=0, g=0, b=0; + + if(!a.s) return; + + if(strstr(a.s, "r") || strstr(a.s, "R")) r=1; + if(strstr(a.s, "g") || strstr(a.s, "G")) g=1; + if(strstr(a.s, "b") || strstr(a.s, "B")) b=1; + + while(!p1.eof()&&!p2.eof()) + { + p2.putrgb( + r ? p1.red() : p2.red(), + g ? p1.green() : p2.green(), + b ? p1.blue() : p2.blue() + ); + p1.next(); + p2.next(); + } +} diff --git a/Plugins/rgbcopy.dll b/Plugins/rgbcopy.dll Binary files differnew file mode 100644 index 0000000..1a995d3 --- /dev/null +++ b/Plugins/rgbcopy.dll diff --git a/Plugins/rgbcopy.exp b/Plugins/rgbcopy.exp Binary files differnew file mode 100644 index 0000000..b85e71e --- /dev/null +++ b/Plugins/rgbcopy.exp diff --git a/Plugins/rgbcopy.lib b/Plugins/rgbcopy.lib Binary files differnew file mode 100644 index 0000000..09edbd5 --- /dev/null +++ b/Plugins/rgbcopy.lib diff --git a/Plugins/rgbcopy.obj b/Plugins/rgbcopy.obj Binary files differnew file mode 100644 index 0000000..5d7194c --- /dev/null +++ b/Plugins/rgbcopy.obj diff --git a/Plugins/setbits.c b/Plugins/setbits.c new file mode 100644 index 0000000..dddc5eb --- /dev/null +++ b/Plugins/setbits.c @@ -0,0 +1,11 @@ +#include <stdlib.h> +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + unsigned char c; + + if(!a.s) return; + c = atoi(a.s); + memset(f.bits, c, f.height*f.lpitch); +} diff --git a/Plugins/setbits.dll b/Plugins/setbits.dll Binary files differnew file mode 100644 index 0000000..9a772ab --- /dev/null +++ b/Plugins/setbits.dll diff --git a/Plugins/setbits.exp b/Plugins/setbits.exp Binary files differnew file mode 100644 index 0000000..484fe3b --- /dev/null +++ b/Plugins/setbits.exp diff --git a/Plugins/setbits.lib b/Plugins/setbits.lib Binary files differnew file mode 100644 index 0000000..1e1db08 --- /dev/null +++ b/Plugins/setbits.lib diff --git a/Plugins/setbits.obj b/Plugins/setbits.obj Binary files differnew file mode 100644 index 0000000..09a9196 --- /dev/null +++ b/Plugins/setbits.obj diff --git a/Plugins/sharemem.h b/Plugins/sharemem.h new file mode 100644 index 0000000..a26d198 --- /dev/null +++ b/Plugins/sharemem.h @@ -0,0 +1,61 @@ +#ifndef __SHAREMEM_H +#define __SHAREMEM_H + +#include <windows.h> +#include <memory.h> + +// +// allocate named shared memory +// +LPVOID smalloc(HANDLE *h, char *name, DWORD size) +{ + LPVOID p; + + *h = CreateFileMapping( + INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, + size, name + ); + + if(*h==NULL) return(NULL); + + p = MapViewOfFile( *h, FILE_MAP_WRITE, 0, 0, 0); + + if(p==NULL) + { + CloseHandle(*h); + return(NULL); + } + return(p); +} + +// +// open access to named shared memory +// +LPVOID smopen(HANDLE *h, char *name) +{ + LPVOID p; + + *h = OpenFileMapping(FILE_MAP_ALL_ACCESS, TRUE, name); + + if(*h==NULL) return(NULL); + + p = MapViewOfFile(*h, FILE_MAP_WRITE, 0, 0, 0); + + if(p==NULL) + { + CloseHandle(*h); + return(NULL); + } + return(p); +} + +// +// cleanup +// +void smfree(HANDLE *h, LPVOID p) +{ + UnmapViewOfFile(p); + CloseHandle(*h); +} + +#endif diff --git a/Plugins/shuffle.c b/Plugins/shuffle.c new file mode 100644 index 0000000..0604595 --- /dev/null +++ b/Plugins/shuffle.c @@ -0,0 +1,42 @@ +#include <string.h> +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + int i, o=1000, x1, y1, x2, y2, range=10; + char *t; + pixel8 *p1, *p2; + pixel32 dot; + byte pixelsize=f.pixelformat/8; + + if(f.pixelformat>32) return; + + if(a.s) + { + o = atoi(a.s); + if(o==0) o=1000; + + if(t = strstr(a.s, " ")) + if((range = atoi(t+1))==0) return; + } + + for(i=0; i<o; i++) + { + x1 = rand()%f.width; + y1 = rand()%f.height; + x2 = x1 + (rand()%(range*2) - range); + y2 = y1 + (rand()%(range*2) - range); + + if(x2<0) x2=0; + if(x2>=f.width) x2=f.width-1; + if(y2<0) y2=0; + if(y2>=f.height) y2=f.height-1; + + p1 = scanline(f, y1); + p2 = scanline(f, y2); + + memcpy(&dot, &p2[x2*pixelsize], pixelsize); + memcpy(&p2[x2*pixelsize], &p1[x1*pixelsize], pixelsize); + memcpy(&p1[x1*pixelsize], &dot, pixelsize); + } +} diff --git a/Plugins/shuffle.dll b/Plugins/shuffle.dll Binary files differnew file mode 100644 index 0000000..bd5d552 --- /dev/null +++ b/Plugins/shuffle.dll diff --git a/Plugins/shuffle.exp b/Plugins/shuffle.exp Binary files differnew file mode 100644 index 0000000..2802b94 --- /dev/null +++ b/Plugins/shuffle.exp diff --git a/Plugins/shuffle.lib b/Plugins/shuffle.lib Binary files differnew file mode 100644 index 0000000..d1bc16f --- /dev/null +++ b/Plugins/shuffle.lib diff --git a/Plugins/shuffle.obj b/Plugins/shuffle.obj Binary files differnew file mode 100644 index 0000000..5c70ab2 --- /dev/null +++ b/Plugins/shuffle.obj diff --git a/Plugins/sonogram.cpp b/Plugins/sonogram.cpp new file mode 100644 index 0000000..821b94a --- /dev/null +++ b/Plugins/sonogram.cpp @@ -0,0 +1,82 @@ +// +// sonogram.cpp +// +// use with fs.sonogram +// +// see example-sonogram.pd +// + +#include <stdlib.h> +#include <stdio.h> +#include <iostream.h> +#include <fstream.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +#define SONOSIZE 128 +#define SONOMAXVAL 500 +#define sonotype float + +int callcount=-1; + +void perform_effect(_frame f, _args a) +{ + if(!a.s) return; + + if(++callcount>=f.width) callcount=0; + + FILE *inf; + if((inf = fopen(a.s, "rb"))==NULL) + { + printf("sonogram: error opening %s\n", a.s); + return; + } + + char buf[80]; + sonotype sono[SONOSIZE]; + int i=0; + + while(!feof(inf)) + { + if(!fgets(buf, 80, inf)) + { + printf("sonogram: read error.\n"); + return; + } + sono[i] = atof(buf); + if(++i>=SONOSIZE) break; + } + fclose(inf); + + int y; + + for(i=0; i<SONOSIZE; i++) + { + // scale values 0-500 to 0-255 + if(sono[i]>SONOMAXVAL) sono[i]=SONOMAXVAL; + sono[i] = (sonotype)((sono[i] / (float)SONOMAXVAL)*255); + // white = no sound + sono[i] = abs(sono[i]-255); + + y = (int)((i / (float)SONOSIZE) * (float)f.height); + // bottom = bass + y = abs((f.height-1) - y); + + switch(f.pixelformat) + { + case 16: + scanline16(f, y)[callcount] = + rgbtocolor16(sono[i], sono[i], sono[i]); + break; + case 24: + scanline24(f, y)[callcount] = + rgbtocolor24(sono[i], sono[i], sono[i]); + break; + case 32: + scanline32(f, y)[callcount] = + rgbtocolor32(sono[i], sono[i], sono[i]); + break; + } + } +} diff --git a/Plugins/sonogram.dll b/Plugins/sonogram.dll Binary files differnew file mode 100644 index 0000000..db6e132 --- /dev/null +++ b/Plugins/sonogram.dll diff --git a/Plugins/sonogram.exp b/Plugins/sonogram.exp Binary files differnew file mode 100644 index 0000000..40a6fae --- /dev/null +++ b/Plugins/sonogram.exp diff --git a/Plugins/sonogram.lib b/Plugins/sonogram.lib Binary files differnew file mode 100644 index 0000000..484c38d --- /dev/null +++ b/Plugins/sonogram.lib diff --git a/Plugins/sonogram.obj b/Plugins/sonogram.obj Binary files differnew file mode 100644 index 0000000..7dd6ee5 --- /dev/null +++ b/Plugins/sonogram.obj 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(); + } +} diff --git a/Plugins/subtract.dll b/Plugins/subtract.dll Binary files differnew file mode 100644 index 0000000..883c541 --- /dev/null +++ b/Plugins/subtract.dll diff --git a/Plugins/subtract.exp b/Plugins/subtract.exp Binary files differnew file mode 100644 index 0000000..9a066ba --- /dev/null +++ b/Plugins/subtract.exp diff --git a/Plugins/subtract.lib b/Plugins/subtract.lib Binary files differnew file mode 100644 index 0000000..5132561 --- /dev/null +++ b/Plugins/subtract.lib diff --git a/Plugins/subtract.obj b/Plugins/subtract.obj Binary files differnew file mode 100644 index 0000000..8405ccc --- /dev/null +++ b/Plugins/subtract.obj diff --git a/Plugins/swap.cpp b/Plugins/swap.cpp new file mode 100644 index 0000000..d1389f4 --- /dev/null +++ b/Plugins/swap.cpp @@ -0,0 +1,62 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +// swap selected area on two images +// args: swap sourcex1 sourcey1 sourcex2 sourcey2 destx desty +// (the selection is of equal size on both images) + +void swapint(int *a, int *b) +{ + int i = *b; + *b = *a; + *a = i; +} + +void perform_copy(_frame f1, _frame f2, _args a) +{ + if(!a.s) return; + + // get args + int sx1, sy1, sx2, sy2, dx1, dy1; + char *t; + + sx1 = atoi(a.s); + if(!(t = strstr(a.s, " "))) return; + sy1 = atoi(t); + if(!(t = strstr(t+1, " "))) return; + sx2 = atoi(t); + if(!(t = strstr(t+1, " "))) return; + sy2 = atoi(t); + if(!(t = strstr(t+1, " "))) return; + dx1 = atoi(t); + if(!(t = strstr(t+1, " "))) return; + dy1 = atoi(t); + + if(sx1>sx2) swapint(&sx1, &sx2); + if(sy1>sy2) swapint(&sy1, &sy2); + +printf("swap: %d %d %d %d - %d %d\n", sx1, sy1, sx2, sy2, dx1, dy1); + + int x, y, i, o; + pixel16 c16; + pixels p1(f1), p2(f2); + + for(y=sy1; y<=sy2; y++) + for(x=sx1; x<=sx2; x++) + { + if(x>=f1.width || y>=f1.height) continue; + i = dx1+(x-sx1); + o = dy1+(y-sy1); + if(i>=f2.width || o>=f2.height) continue; + + p1.moveto(x, y); + p2.moveto(i, o); + + c16 = p2.dot16(); + p2.dot16(p1.dot16()); + p1.dot16(c16); + } +} diff --git a/Plugins/swap.dll b/Plugins/swap.dll Binary files differnew file mode 100644 index 0000000..ee04f4c --- /dev/null +++ b/Plugins/swap.dll diff --git a/Plugins/swap.exp b/Plugins/swap.exp Binary files differnew file mode 100644 index 0000000..8015b40 --- /dev/null +++ b/Plugins/swap.exp diff --git a/Plugins/swap.lib b/Plugins/swap.lib Binary files differnew file mode 100644 index 0000000..bda1a31 --- /dev/null +++ b/Plugins/swap.lib diff --git a/Plugins/swap.obj b/Plugins/swap.obj Binary files differnew file mode 100644 index 0000000..cca03a8 --- /dev/null +++ b/Plugins/swap.obj diff --git a/Plugins/tile.cpp b/Plugins/tile.cpp new file mode 100644 index 0000000..47fa5ca --- /dev/null +++ b/Plugins/tile.cpp @@ -0,0 +1,59 @@ +#include <stdlib.h> +#include <string.h> +#include "plugin.h" +#include "pixels.h" + +void perform_copy(_frame f1, _frame f2, _args a) +{ + pixels px(f2); + pixel16 *p16; + pixel24 *p24; + pixel32 *p32; + int tile, tiley=-1, prevy=-1; + char *t; + + tile = atoi(a.s); + if(tile<=0) tile=2; + if(t = strstr(a.s, " ")) + { + tiley = atoi(t+1); + if(tiley<=0) tiley=2; + } + + // i could have the switch() inside the while-loop.. + // but is it more efficient this way? + + switch(f1.pixelformat) + { + case 16: + while(!px.eof()) { + if(px.y != prevy) { + p16 = scanline16(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot16(p16[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + case 24: + while(!px.eof()) { + if(px.y != prevy) { + p24 = scanline24(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot24(p24[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + case 32: + while(!px.eof()) { + if(px.y != prevy) { + p32 = scanline32(f1, (px.y * (tiley>0 ? tiley : tile))%f1.height); + prevy = px.y; + } + px.dot32(p32[ (px.x * tile)%f1.width ]); + px.next(); + } + break; + } +} diff --git a/Plugins/tile.dll b/Plugins/tile.dll Binary files differnew file mode 100644 index 0000000..58a8886 --- /dev/null +++ b/Plugins/tile.dll diff --git a/Plugins/tile.exp b/Plugins/tile.exp Binary files differnew file mode 100644 index 0000000..69d5907 --- /dev/null +++ b/Plugins/tile.exp diff --git a/Plugins/tile.lib b/Plugins/tile.lib Binary files differnew file mode 100644 index 0000000..1f0732e --- /dev/null +++ b/Plugins/tile.lib diff --git a/Plugins/tile.obj b/Plugins/tile.obj Binary files differnew file mode 100644 index 0000000..8409075 --- /dev/null +++ b/Plugins/tile.obj diff --git a/Plugins/vf2fs.c b/Plugins/vf2fs.c new file mode 100644 index 0000000..47e856e --- /dev/null +++ b/Plugins/vf2fs.c @@ -0,0 +1,49 @@ +// +// readvf.c +// used to display vframe objects +// +// 1st argument is name of shared memory +// to struct vframeimage (see Externals\vframe.h) +// + +#include <memory.h> +#include "plugin.h" +#include "sharemem.h" +#include "vframe.h" + +void perform_effect(_frame f, _args a) +{ + HANDLE hlvframe=NULL, hl=NULL; + LPVOID p=NULL; + struct vframeimage *vfp=NULL; + unsigned long c; + + if(!a.s) return; + + vfp = (struct vframeimage *)smopen(&hlvframe, a.s); + if(vfp==NULL) return; + +// printf("name %s width %d height %d pf %d bits %s\n", +// a.s, vfp->f.width, vfp->f.height, vfp->f.pixelformat, vfp->bitsname); + + if(f.pixelformat != vfp->f.pixelformat) + { + printf("vf2fs: pixelformats are different. no resampling available.\n"); + return; + } + + p = smopen(&hl, vfp->bitsname); + if(p==NULL) + { + CloseHandle(hlvframe); + return; + } + + c = (f.height*f.lpitch < vfp->f.height*vfp->f.lpitch) ? + f.height*f.lpitch : vfp->f.height*vfp->f.lpitch; + + memcpy(f.bits, p, c); + + smfree(&hl, p); + smfree(&hlvframe, vfp); +} diff --git a/Plugins/vf2fs.dll b/Plugins/vf2fs.dll Binary files differnew file mode 100644 index 0000000..d51abad --- /dev/null +++ b/Plugins/vf2fs.dll diff --git a/Plugins/vf2fs.exp b/Plugins/vf2fs.exp Binary files differnew file mode 100644 index 0000000..c9ce25b --- /dev/null +++ b/Plugins/vf2fs.exp diff --git a/Plugins/vf2fs.lib b/Plugins/vf2fs.lib Binary files differnew file mode 100644 index 0000000..0c52583 --- /dev/null +++ b/Plugins/vf2fs.lib diff --git a/Plugins/vf2fs.obj b/Plugins/vf2fs.obj Binary files differnew file mode 100644 index 0000000..4c0a7bd --- /dev/null +++ b/Plugins/vf2fs.obj diff --git a/Plugins/xbend.c b/Plugins/xbend.c new file mode 100644 index 0000000..1ba9959 --- /dev/null +++ b/Plugins/xbend.c @@ -0,0 +1,99 @@ +#include <stdlib.h> +#include <string.h> +#include "plugin.h" + +void perform_effect(_frame f, _args a) +{ + byte pixelsize = f.pixelformat/8; + int x, y, pos, pos2, widthminuspos, widthminuspos2; + pixel8 *p, *tp=0; + char *t; + + if(!a.s) return; + + pos = atoi(a.s); + if(t = strstr(a.s, " ")) + { + pos2 = atoi(t+1); + tp = (pixel8 *)malloc(f.width*pixelsize); + } + + if(pos<0) pos=0; + if(pos>=f.width) pos=f.width-1; + if(pos2<0) pos2=0; + if(pos2>=f.width) pos2=f.width-1; + + widthminuspos = f.width-pos; + widthminuspos2 = f.width-pos2; + + for(y=0; y<f.height; y++) + { + p = scanline(f, y); + for(x=0; x<f.width; x++) + { + if(!tp) +// p[x] = x<pos||pos-(x-pos)<0 ? p[x] : p[pos-(x-pos)]; + memcpy(&p[x*pixelsize], + x<pos||pos-(x-pos)<0 ? &p[x*pixelsize] : &p[(pos-(x-pos))*pixelsize], + pixelsize); + else + { + memcpy(&tp[x*pixelsize], + &p[x<pos ? ((int)(x/(float)pos*pos2))*pixelsize + : (pos2+(int)(((x-pos)/(float)widthminuspos*widthminuspos2)))*pixelsize], + pixelsize); + } + } + if(tp) memcpy(p, tp, f.width*pixelsize); + } + if(tp) free(tp); +} + +void perform_copy(_frame f1, _frame f2, _args a) +{ + byte pixelsize = f1.pixelformat/8; + int x, y, w, h, pos, pos2, widthminuspos, widthminuspos2, widthminusone; + pixel8 *p1, *p2, tp=0; + char *t; + + if(!a.s) return; + + pos = atoi(a.s); + if(t = strstr(a.s, " ")) + { + pos2 = atoi(t+1); + tp = 1; + } + + w = f1.width<f2.width ? f1.width : f2.width; + h = f1.height<f2.height ? f1.height : f2.height; + + if(pos<0) pos=0; + if(pos>=w) pos=w-1; + if(pos2<0) pos2=0; + if(pos2>=w) pos2=w-1; + + widthminuspos = f1.width-pos; + widthminuspos2 = f1.width-pos2; + widthminusone = w-1; + + for(y=0; y<h; y++) + { + p1 = scanline(f1, y); + p2 = scanline(f2, y); + for(x=0; x<w; x++) + { + if(!tp) + memcpy(&p2[x*pixelsize], + x<pos||pos-(x-pos)<0 ? &p1[x*pixelsize] : &p1[(pos-(x-pos))*pixelsize], + pixelsize); + else + { + memcpy(&p2[x*pixelsize], + &p1[ x<pos ? ((int)(x/(float)pos*pos2))*pixelsize + : (pos2+(int)(((x-pos)/(float)widthminuspos*widthminuspos2)))*pixelsize], + pixelsize); + } + } + } +} diff --git a/Plugins/xbend.dll b/Plugins/xbend.dll Binary files differnew file mode 100644 index 0000000..fb6f033 --- /dev/null +++ b/Plugins/xbend.dll diff --git a/Plugins/xbend.exp b/Plugins/xbend.exp Binary files differnew file mode 100644 index 0000000..99b93f3 --- /dev/null +++ b/Plugins/xbend.exp diff --git a/Plugins/xbend.lib b/Plugins/xbend.lib Binary files differnew file mode 100644 index 0000000..b54972e --- /dev/null +++ b/Plugins/xbend.lib diff --git a/Plugins/xbend.obj b/Plugins/xbend.obj Binary files differnew file mode 100644 index 0000000..4854676 --- /dev/null +++ b/Plugins/xbend.obj diff --git a/Plugins/xshred.c b/Plugins/xshred.c new file mode 100644 index 0000000..6918e50 --- /dev/null +++ b/Plugins/xshred.c @@ -0,0 +1,20 @@ +#include <stdlib.h> +#include "plugin.h" + +void perform_copy(_frame f1, _frame f2, _args a) +{ + int step, w, h, y, pixelsize=f1.pixelformat/8; + + if(!a.s) return; + + step = atoi(a.s); + if(step<=0) step=1; + + w = f1.width<f2.width ? f1.width : f2.width; + h = f1.height<f2.height ? f1.height : f2.height; + + for(y=0; y<h; y+=step) + { + memcpy(scanline(f2, y), scanline(f1, y), pixelsize*w); + } +} diff --git a/Plugins/xshred.dll b/Plugins/xshred.dll Binary files differnew file mode 100644 index 0000000..9ddf030 --- /dev/null +++ b/Plugins/xshred.dll diff --git a/Plugins/xshred.exp b/Plugins/xshred.exp Binary files differnew file mode 100644 index 0000000..881e90e --- /dev/null +++ b/Plugins/xshred.exp diff --git a/Plugins/xshred.lib b/Plugins/xshred.lib Binary files differnew file mode 100644 index 0000000..c90c4df --- /dev/null +++ b/Plugins/xshred.lib diff --git a/Plugins/xshred.obj b/Plugins/xshred.obj Binary files differnew file mode 100644 index 0000000..484ad30 --- /dev/null +++ b/Plugins/xshred.obj |