From 487b091db3e5be5423f633a6e220a9bbc62e98ad Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 23 Apr 2021 13:20:20 +0200 Subject: [PATCH] work on the special fx demo --- tools/Makefile | 2 ++ tools/fimgfx.c | 22 +++++++++++++++++----- tools/fx_demo.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100755 tools/fx_demo.sh diff --git a/tools/Makefile b/tools/Makefile index 53b2985d..ef8c091e 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -2,6 +2,8 @@ # makefile for floatimg tools # use with caution # +# PLEASE ! update to the 'Global.makefile' concept ! +# COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm DEPS = ../floatimg.h ../libfloatimg.a Makefile diff --git a/tools/fimgfx.c b/tools/fimgfx.c index 92817fb5..ef1af3e7 100644 --- a/tools/fimgfx.c +++ b/tools/fimgfx.c @@ -31,13 +31,13 @@ Fx fx_list[] = { { "pow2", Fx_pow2, 0, 1 }, { "sqrt", Fx_sqrt, 0, 1 }, { "gray0", Fx_gray0, 0, 1 }, - { "halfsz0", Fx_halfsz0, 0, 1 }, - { "rot90", Fx_rot90, 0, 0 }, +// { "halfsz0", Fx_halfsz0, 0, 1 }, +// { "rot90", Fx_rot90, 0, 0 }, { "cmixa", Fx_cmixa, 0, 1 }, { "xper", Fx_xper, 0, 1 }, { "desat", Fx_desat, 0, 1 }, { "ctr2x2", Fx_ctr2x2, 0, 1 }, - { "norm", Fx_norm, 0, 1 }, +// { "norm", Fx_norm, 0, 1 }, { "classtrial", Fx_classtrial, 0, 1 }, { "binarize", Fx_binarize, 0, 1 }, { "trinarize", Fx_trinarize, 0, 1 }, @@ -45,6 +45,14 @@ Fx fx_list[] = { { NULL, 0, 0, 0 } }; +/* --------------------------------------------------------------------- */ +static void list_of_effects(void) +{ +Fx *fx; +for (fx=fx_list; fx->name; fx++) { + printf("%s\n", fx->name); + } +} /* --------------------------------------------------------------------- */ int lookup_fxidx(char *txt) { @@ -105,6 +113,7 @@ puts("\tfimgfx [options] source.fimg resultat.fimg"); puts("options:"); puts("\t-k N.N\tset the floating value"); +puts("\t-l\tlist effects"); puts("\t-v\tincrease verbosity"); puts("effects:"); @@ -217,9 +226,11 @@ switch (action) { } +// foo = fimg_export_picture(&dest, dstfname, 0); foo = fimg_dump_to_file(&dest, dstfname, 0); if (foo) { - fprintf(stderr, "dumping datas to file give us a %d\n", foo); + fprintf(stderr, "dumping datas to file '%s' give us a %d\n", + dstfname, foo); return foo; } @@ -240,10 +251,11 @@ char *operator; char *srcname = ""; char *dstname = "out.fimg"; -while ((opt = getopt(argc, argv, "hk:v")) != -1) { +while ((opt = getopt(argc, argv, "hk:lv")) != -1) { switch(opt) { case 'h': help(0); break; case 'k': global_fvalue = atof(optarg); break; + case 'l': list_of_effects(); exit(0); case 'v': verbosity++; break; } } diff --git a/tools/fx_demo.sh b/tools/fx_demo.sh new file mode 100755 index 00000000..dc56b404 --- /dev/null +++ b/tools/fx_demo.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +SRC="in.fimg" +K="0.414" +TMP="/tmp/foo.fimg" + +for fx in $(./fimgfx -l) +do + + printf "========== %-12s =========\n" $fx + + outfile=$(printf "/tmp/fx_%s.png" $fx) + echo $outfile + + rm $TMP + ./fimgfx -v -k $K $fx $SRC $TMP + if [ $? \!= 0 ] ; then + echo error $? + exit 1 + fi + + ./fimg2png -v $TMP $outfile + + echo ; sleep 1 + +done