work on the special fx demo

This commit is contained in:
tth 2021-04-23 13:20:20 +02:00
parent ce73143d96
commit 487b091db3
3 changed files with 45 additions and 5 deletions

View File

@ -2,6 +2,8 @@
# makefile for floatimg tools # makefile for floatimg tools
# use with caution # use with caution
# #
# PLEASE ! update to the 'Global.makefile' concept !
#
COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm COPT = -Wall -fpic -g -DDEBUG_LEVEL=0 -lm
DEPS = ../floatimg.h ../libfloatimg.a Makefile DEPS = ../floatimg.h ../libfloatimg.a Makefile

View File

@ -31,13 +31,13 @@ Fx fx_list[] = {
{ "pow2", Fx_pow2, 0, 1 }, { "pow2", Fx_pow2, 0, 1 },
{ "sqrt", Fx_sqrt, 0, 1 }, { "sqrt", Fx_sqrt, 0, 1 },
{ "gray0", Fx_gray0, 0, 1 }, { "gray0", Fx_gray0, 0, 1 },
{ "halfsz0", Fx_halfsz0, 0, 1 }, // { "halfsz0", Fx_halfsz0, 0, 1 },
{ "rot90", Fx_rot90, 0, 0 }, // { "rot90", Fx_rot90, 0, 0 },
{ "cmixa", Fx_cmixa, 0, 1 }, { "cmixa", Fx_cmixa, 0, 1 },
{ "xper", Fx_xper, 0, 1 }, { "xper", Fx_xper, 0, 1 },
{ "desat", Fx_desat, 0, 1 }, { "desat", Fx_desat, 0, 1 },
{ "ctr2x2", Fx_ctr2x2, 0, 1 }, { "ctr2x2", Fx_ctr2x2, 0, 1 },
{ "norm", Fx_norm, 0, 1 }, // { "norm", Fx_norm, 0, 1 },
{ "classtrial", Fx_classtrial, 0, 1 }, { "classtrial", Fx_classtrial, 0, 1 },
{ "binarize", Fx_binarize, 0, 1 }, { "binarize", Fx_binarize, 0, 1 },
{ "trinarize", Fx_trinarize, 0, 1 }, { "trinarize", Fx_trinarize, 0, 1 },
@ -45,6 +45,14 @@ Fx fx_list[] = {
{ NULL, 0, 0, 0 } { 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) int lookup_fxidx(char *txt)
{ {
@ -105,6 +113,7 @@ puts("\tfimgfx [options] <effect> source.fimg resultat.fimg");
puts("options:"); puts("options:");
puts("\t-k N.N\tset the floating value"); puts("\t-k N.N\tset the floating value");
puts("\t-l\tlist effects");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
puts("effects:"); puts("effects:");
@ -217,9 +226,11 @@ switch (action) {
} }
// foo = fimg_export_picture(&dest, dstfname, 0);
foo = fimg_dump_to_file(&dest, dstfname, 0); foo = fimg_dump_to_file(&dest, dstfname, 0);
if (foo) { 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; return foo;
} }
@ -240,10 +251,11 @@ char *operator;
char *srcname = ""; char *srcname = "";
char *dstname = "out.fimg"; char *dstname = "out.fimg";
while ((opt = getopt(argc, argv, "hk:v")) != -1) { while ((opt = getopt(argc, argv, "hk:lv")) != -1) {
switch(opt) { switch(opt) {
case 'h': help(0); break; case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break; case 'k': global_fvalue = atof(optarg); break;
case 'l': list_of_effects(); exit(0);
case 'v': verbosity++; break; case 'v': verbosity++; break;
} }
} }

26
tools/fx_demo.sh Executable file
View File

@ -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