Bibliothèque de traitements d'images en virgule flottante. http://la.buvette.org/photos/cumul/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FloatImg/essai.c

82 lines
1.6 KiB

4 years ago
/*
testing some random funcs.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
4 years ago
#include <math.h>
#include <string.h>
#include "floatimg.h"
int verbosity;
4 years ago
/* --------------------------------------------------------------------- */
void fait_un_dessin(FloatImg *dessin)
4 years ago
{
fimg_draw_something(dessin);
4 years ago
}
/* --------------------------------------------------------------------- */
void help(int k)
{
puts("Options :");
puts("\t-d WxH\timage size");
exit(0);
}
/* --------------------------------------------------------------------- */
4 years ago
int main(int argc, char *argv[])
{
FloatImg fimgA, fimgB;
int foo, opt;
int W = 800, H = 600;
4 years ago
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;
}
}
4 years ago
if (verbosity) fimg_print_version(0);
4 years ago
fimg_create(&fimgA, W, H, 3);
fimg_create(&fimgB, W, H, 3);
3 years ago
fimg_clear(&fimgA);
4 years ago
fimg_drand48(&fimgB, 100.0);
3 years ago
foo = fimg_dump_to_file(&fimgB, "B.fimg", 0);
fimg_timer_set(0);
#define NBP 500
for (foo=0; foo<NBP; foo++) {
if (verbosity) {
printf("%5d / %5d\n", foo, NBP);
}
fait_un_dessin(&fimgB);
fimg_add_3(&fimgA, &fimgB, &fimgA);
3 years ago
// fimg_mul(&fimgA, &fimgB, &fimgA);
}
4 years ago
tb = fimg_timer_get(0);
fprintf(stderr, "%s = %f seconds\n", __func__, tb);
foo = fimg_save_as_pnm(&fimgA, "drand48.pnm", 0);
3 years ago
foo = fimg_dump_to_file(&fimgA, "drand48.fimg", 0);
4 years ago
fimg_destroy(&fimgA);
fimg_destroy(&fimgB);
return 0;
}
/* --------------------------------------------------------------------- */