Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. #include <math.h>
  2. #include <stdlib.h>
  3. void pix(int frame, int alen, int achannels, short *abuf,
  4.  int ww, int wh, int bpp, unsigned char *dst, unsigned char *src,
  5.  unsigned char *buf2, unsigned char *buf3)
  6. {
  7.  int o, o1, x, y, x1, y1, dx=bpp, dy=bpp*ww;
  8.  int benji,gerti,edwin;
  9. // int rx=rand()/(RAND_MAX/3); int ry=rand()/(RAND_MAX/3);
  10.  for(y=0; y<wh; y++) {
  11.   for(x=0; x<ww; x++) {
  12.    // o - position, should be: 0 <= o <= (ww*dx+y*dy-1)
  13.    o=x*dx+y*dy;
  14.    // simple move + fade
  15. //   x1=x+(sin(-1+2.0*x/ww)*16);
  16. //   y1=y+wh/(y+1);
  17. benji=4*sin(frame*0.31);
  18. gerti=5*cos(frame*0.19);
  19. //edwin=3*cos(frame*0.047);
  20. if(x!=ww/2-1) x1=x+(ww/(x-0.5*ww+1.0)+sin(frame*0.11)*20.0)/\
  21.                    (1+4*benji); else x1=0;
  22. if(y!=wh/2-1) y1=y+(wh/(y-0.5*wh+1.0)+cos(frame*0.13)*20.0)/\
  23.                    (1+4*gerti); else y1=0;
  24.    if(x1>=0 && x1<ww && y1>=0 && y1<wh) o1=x1*dx+y1*dy; else o1=0;
  25.     dst[0+o]=dst[0+o]*14/32+src[0+o1]*18/32; // blue
  26.     dst[1+o]=dst[1+o]*14/32+src[1+o1]*18/32; // green
  27.     dst[2+o]=dst[2+o]*14/32+src[2+o1]*18/32; // red
  28.   }
  29.  }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement