forked from tTh/FloatImg
66 lines
1.2 KiB
C
66 lines
1.2 KiB
C
|
/*
|
||
|
* test des trucs
|
||
|
*/
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#include "../floatimg.h"
|
||
|
#include "glitches.h"
|
||
|
|
||
|
/* ----------------------------------------------------------- */
|
||
|
|
||
|
int verbosity;
|
||
|
|
||
|
#define PNG "out.png"
|
||
|
#define W 512
|
||
|
#define H 256
|
||
|
#define LMAX 233.333
|
||
|
#define TIMER 1
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
int foo, iter, xloc, bloub;
|
||
|
FloatImg image;
|
||
|
char buff[1000];
|
||
|
double debut, fin;
|
||
|
float omega;
|
||
|
verbosity = 1;
|
||
|
|
||
|
fimg_print_version(1);
|
||
|
|
||
|
foo = fimg_create(&image, W, H, FIMG_TYPE_RGB);
|
||
|
if (foo) {
|
||
|
fprintf(stderr, "err %d create image\n", foo);
|
||
|
exit(1);
|
||
|
}
|
||
|
fimg_vdeg_a(&image, LMAX);
|
||
|
|
||
|
debut = fimg_timer_set(TIMER);
|
||
|
|
||
|
for (iter=0; iter<64; iter++) {
|
||
|
|
||
|
for (bloub=0; bloub<5; bloub++) {
|
||
|
xloc = rand() % W;
|
||
|
omega = (float)(0.1 + drand48()*0.8) * 0.5;
|
||
|
foo = vertical_singlitch(&image, xloc, LMAX,
|
||
|
omega, (float)iter);
|
||
|
if (foo) abort();
|
||
|
}
|
||
|
|
||
|
sprintf(buff, "out%03d.png", iter);
|
||
|
foo = fimg_save_as_png(&image, buff, 0);
|
||
|
if (foo) {
|
||
|
fprintf(stderr, "err %d saving to '%s'\n", foo, PNG);
|
||
|
exit(1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fin = fimg_timer_set(TIMER);
|
||
|
fprintf(stderr, "elapsed %f\n", fin-debut);
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
/* ----------------------------------------------------------- */
|