From f8d8ce4d35bfbba5391af2a3fbce2ad88f94dd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juha=20Vehvil=C3=A4inen?= Date: Tue, 9 Jul 2002 12:36:46 +0000 Subject: PeRColate svn path=/trunk/Framestein/; revision=31 --- Plugins/keyscreen.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 Plugins/keyscreen.c (limited to 'Plugins/keyscreen.c') diff --git a/Plugins/keyscreen.c b/Plugins/keyscreen.c new file mode 100644 index 0000000..45aea88 --- /dev/null +++ b/Plugins/keyscreen.c @@ -0,0 +1,131 @@ +// 242.keyscreen -- does 3-source chroma keying. +// by r. luke dubois (luke@music.columbia.edu), +// computer music center, columbia university, 2001. +// +// Pd / Framestein port by Olaf Matthes , June 2002 +// +// objects and source are provided without warranty of any kind, express or implied. +// +// usage: keyscreen +// +// f2 is the key & target, f1 is the mask +// + +#include +#include +#include "plugin.h" + +void perform_effect(struct frame f, struct args a) +{ + printf("Using keyscreen as effect does nothing!\n"); +} + +void perform_copy(struct frame f1, struct frame f2, struct args a) +{ + short x, y, w, h; + pixel16 *pix1_16, *pix2_16; + pixel24 *pix1_24, *pix2_24; + pixel32 *pix1_32, *pix2_32; + byte redpix, greenpix, bluepix; + byte red, green, blue, check, rf, gf, bf; + char *t; + + w = f1.width=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf))) + { + check = 1; // mask it + } + + + if(check) // output frame 1 + { + pix2_16[x] = pix1_16[x]; + } + } + } + break; + case 24: + for(y = 0; y < h; y++) + { + pix1_24 = scanline24(f1, y); + pix2_24 = scanline24(f2, y); + for(x = 0; x < w; x++) + { + check = 0; // start with each pixel anew + + redpix = r24(pix2_24[x]); + greenpix = g24(pix2_24[x]); + bluepix = b24(pix2_24[x]); + if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf))) + { + check = 1; // mask it + } + + + if(check) // output frame 1 + { + pix1_24[x] = pix1_24[x]; + } + } + } + break; + case 32: + for(y = 0; y < h; y++) + { + pix1_32 = scanline32(f1, y); + pix2_32 = scanline32(f2, y); + for(x = 0; x < w; x++) + { + check = 0; // start with each pixel anew + + redpix = r32(pix2_32[x]); + greenpix = g32(pix2_32[x]); + bluepix = b32(pix2_32[x]); + if ((redpix>=(red-rf))&&(redpix<=(red+rf))&&(greenpix>=(green-gf))&&(greenpix<=(green+gf))&&(bluepix>=(blue-bf))&&(bluepix<=(blue+bf))) + { + check = 1; // mask it + } + + + if(check) // output frame 1 + { + pix2_32[x] = pix1_32[x]; + } + } + } + break; + } +} -- cgit v1.2.1