diff --git a/tools/Makefile b/tools/Makefile index 40a352e..6473fa1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -36,7 +36,7 @@ mkfimg: mkfimg.c $(DEPS) gcc $(COPT) $< ../libfloatimg.a -lm -o $@ fimgops: fimgops.c $(DEPS) - gcc $(COPT) $< ../libfloatimg.a -o $@ + gcc $(COPT) $< ../libfloatimg.a -lm -o $@ fimgfx: fimgfx.c $(DEPS) gcc $(COPT) $< ../libfloatimg.a \ diff --git a/tools/fimgops.c b/tools/fimgops.c index 5182ba2..6be390d 100644 --- a/tools/fimgops.c +++ b/tools/fimgops.c @@ -66,6 +66,7 @@ static void help(int lj) puts("usage:\n\tfimgops [options] A.fimg B.fimg operator D.fimg"); puts("options:"); +puts("\t-a\t\texport absolute value"); // puts("\t-g convert output to gray"); printf("\t-k N.N\t\tset float value (def=%.3f)\n", global_fvalue); puts("\t-v\t\tincrease verbosity"); @@ -107,13 +108,15 @@ return foo; int main(int argc, char *argv[]) { int foo, opt, action; +int absolute = 0; char *operator; FloatImg srcA, srcB, dest; global_fvalue = 0.5; -while ((opt = getopt(argc, argv, "hk:v")) != -1) { +while ((opt = getopt(argc, argv, "ahk:v")) != -1) { switch(opt) { + case 'a': absolute = 1; break; case 'g': break; case 'h': help(0); break; case 'k': global_fvalue = atof(optarg); break; @@ -182,6 +185,11 @@ if (foo) { operator, foo); } +if (absolute) { + if (verbosity) fprintf(stderr, "compute abs of %p\n", &dest); + fimg_absolute(&dest); + } + foo = fimg_dump_to_file(&dest, argv[optind+3], 0); if (foo) { fprintf(stderr, "dumping datas to file give us a %d\n", foo);