Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <stdlib.h>
- void pix(int frame, int alen, int achannels, short *abuf,
- int ww, int wh, int bpp, unsigned char *dst, unsigned char *src,
- unsigned char *buf2, unsigned char *buf3)
- {
- int o, o1, x, y, x1, y1, dx=bpp, dy=bpp*ww;
- int benji,gerti,edwin;
- // int rx=rand()/(RAND_MAX/3); int ry=rand()/(RAND_MAX/3);
- for(y=0; y<wh; y++) {
- for(x=0; x<ww; x++) {
- // o - position, should be: 0 <= o <= (ww*dx+y*dy-1)
- o=x*dx+y*dy;
- // simple move + fade
- // x1=x+(sin(-1+2.0*x/ww)*16);
- // y1=y+wh/(y+1);
- benji=4*sin(frame*0.31);
- gerti=5*cos(frame*0.19);
- //edwin=3*cos(frame*0.047);
- if(x!=ww/2-1) x1=x+(ww/(x-0.5*ww+1.0)+sin(frame*0.11)*20.0)/\
- (1+4*benji); else x1=0;
- if(y!=wh/2-1) y1=y+(wh/(y-0.5*wh+1.0)+cos(frame*0.13)*20.0)/\
- (1+4*gerti); else y1=0;
- if(x1>=0 && x1<ww && y1>=0 && y1<wh) o1=x1*dx+y1*dy; else o1=0;
- dst[0+o]=dst[0+o]*14/32+src[0+o1]*18/32; // blue
- dst[1+o]=dst[1+o]*14/32+src[1+o1]*18/32; // green
- dst[2+o]=dst[2+o]*14/32+src[2+o1]*18/32; // red
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement