From 360c2e113ad90d19ad5e58019a6a9415adfa76af Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Fri, 10 Jan 2020 14:18:38 +0100 Subject: [PATCH] added gray conversion to fimgfx --- lib/fimg-2gray.c | 2 +- tools/fimgfx.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/fimg-2gray.c b/lib/fimg-2gray.c index cf7ab5f..70723bb 100644 --- a/lib/fimg-2gray.c +++ b/lib/fimg-2gray.c @@ -15,7 +15,7 @@ extern int verbosity; /* must be declared around main() */ /* * floating imgs MUST be allocated before calling this func. */ -int fimg_mk_gray_from(FloatImg *src, FloatImg*dst, int k) +int fimg_mk_gray_from(FloatImg *src, FloatImg *dst, int k) { float kr, kg, kb, kdiv; int nbb, foo; diff --git a/tools/fimgfx.c b/tools/fimgfx.c index 03eef01..9a8f378 100644 --- a/tools/fimgfx.c +++ b/tools/fimgfx.c @@ -19,13 +19,14 @@ typedef struct { int nbarg; } Fx; -enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt }; +enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0 }; Fx fx_list[] = { { "cos01", Fx_cos01, 0 }, { "cos010", Fx_cos010, 0 }, { "pow2", Fx_pow2, 0 }, { "sqrt", Fx_sqrt, 0 }, + { "gray0", Fx_gray0, 0 }, { NULL, 0, 0 } }; @@ -59,6 +60,10 @@ puts("------ fimg special effects ------"); puts("usage:"); puts("\tfimgfix [options] source.fimg resultat.fimg"); +puts("options:"); +puts("\t-k N.N\tset the floating value"); +puts("\t-v\tincrease verbosity"); + puts("effects:"); printf("\t"); for (fx=fx_list; fx->name; fx++) { @@ -103,6 +108,10 @@ switch (act) { case Fx_sqrt: fimg_square_root(&src, &dest, maxval); break; + case Fx_gray0: /* new 2020 01 10 */ + fimg_to_gray(&src); fimg_copy_data(&src, &dest); + break; + default: fprintf(stderr, "*** %s : %d is bad action\n", __func__, act); break;