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/vf2fs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Plugins/vf2fs.c (limited to 'Plugins/vf2fs.c') 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 +#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); +} -- cgit v1.2.1