/* * EffecTV - Realtime Digital Video Effector * Copyright (C) 2001-2003 FUKUCHI Kentaro * * ShagadelicTV - makes you shagadelic! Yeah baby yeah! * Copyright (C) 2001-2002 FUKUCHI Kentaro * * Inspired by Adrian Likin's script for the GIMP. */ #include #include #include #include "EffecTV.h" #include "utils.h" static int start(void); static int stop(void); static int draw(RGB32 *src, RGB32 *dest); static char *effectname = "ShagadelicTV"; static int stat; static char *ripple; static char *spiral; static unsigned char phase; static int rx, ry; static int bx, by; static int rvx, rvy; static int bvx, bvy; static int mask; effect *shagadelicRegister() { effect *entry; sharedbuffer_reset(); ripple = (char *)sharedbuffer_alloc(video_area*4); spiral = (char *)sharedbuffer_alloc(video_area); if(ripple == NULL || spiral == NULL) { return NULL; } entry = (effect *)malloc(sizeof(effect)); if(entry == NULL) { return NULL; } entry->name = effectname; entry->start = start; entry->stop = stop; entry->draw = draw; entry->event = 0; return entry; } static int start() { int i, x, y; #ifdef PS2 float xx, yy; #else double xx, yy; #endif mask = 0xffffff; i = 0; for(y=0; y>8; /* Try another Babe! * v = *src++; * *dest++ = v & ((r<<16)|(g<<8)|b); */ r = (char)(*pr+phase*2)>>7; g = (char)(*pg+phase*3)>>7; b = (char)(*pb-phase)>>7; *dest++ = v & ((r<<16)|(g<<8)|b) & mask; pr++; pg++; pb++; } pr += video_width; pb += video_width; } phase -= 8; if((rx+rvx)<0 || (rx+rvx)>=video_width) rvx =-rvx; if((ry+rvy)<0 || (ry+rvy)>=video_height) rvy =-rvy; if((bx+bvx)<0 || (bx+bvx)>=video_width) bvx =-bvx; if((by+bvy)<0 || (by+bvy)>=video_height) bvy =-bvy; rx += rvx; ry += rvy; bx += bvx; by += bvy; return 0; }