80 lines
1.5 KiB
C
80 lines
1.5 KiB
C
/*
|
|
testing some random funcs.
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <math.h>
|
|
#include <string.h>
|
|
|
|
#include "floatimg.h"
|
|
|
|
int verbosity;
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
void fait_un_dessin(char *fname)
|
|
{
|
|
FloatImg dessin;
|
|
double tb;
|
|
|
|
puts("");
|
|
fimg_timer_set(0);
|
|
fimg_create(&dessin, 3200, 2400, 3);
|
|
fimg_draw_something(&dessin);
|
|
fimg_dump_to_file(&dessin, "dessin.fimg", 0);
|
|
fimg_destroy(&dessin);
|
|
tb = fimg_timer_get(0);
|
|
fprintf(stderr, "%s = %f seconds\n", __func__, tb);
|
|
|
|
puts("");
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
void help(int k)
|
|
{
|
|
puts("Options :");
|
|
puts("\t-d WxH\timage size");
|
|
exit(0);
|
|
}
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
FloatImg fimgA, fimgB;
|
|
int foo, opt;
|
|
int W = 800, H = 600;
|
|
double tb;
|
|
|
|
while ((opt = getopt(argc, argv, "d:hv")) != -1) {
|
|
switch(opt) {
|
|
case 'd': parse_WxH(optarg, &W, &H);
|
|
break;
|
|
case 'h': help(0); break;
|
|
case 'v': verbosity++; break;
|
|
}
|
|
}
|
|
|
|
if (verbosity) fimg_print_version(0);
|
|
|
|
fimg_create(&fimgA, W, H, 3);
|
|
fimg_create(&fimgB, W, H, 3);
|
|
|
|
fimg_timer_set(0);
|
|
fimg_drand48(&fimgB, 100.0);
|
|
fimg_drand48(&fimgA, 100.0);
|
|
fimg_add(&fimgA, &fimgB, &fimgA);
|
|
tb = fimg_timer_get(0);
|
|
fprintf(stderr, "%s = %f seconds\n", __func__, tb);
|
|
foo = fimg_save_as_pnm(&fimgA, "drand48.pnm", 0);
|
|
|
|
fimg_destroy(&fimgA);
|
|
fimg_destroy(&fimgB);
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|