added gray conversion to fimgfx

This commit is contained in:
Tonton Th 2020-01-10 14:18:38 +01:00
parent 0104a736ea
commit 360c2e113a
2 changed files with 11 additions and 2 deletions

View File

@ -19,13 +19,14 @@ typedef struct {
int nbarg; int nbarg;
} Fx; } 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[] = { Fx fx_list[] = {
{ "cos01", Fx_cos01, 0 }, { "cos01", Fx_cos01, 0 },
{ "cos010", Fx_cos010, 0 }, { "cos010", Fx_cos010, 0 },
{ "pow2", Fx_pow2, 0 }, { "pow2", Fx_pow2, 0 },
{ "sqrt", Fx_sqrt, 0 }, { "sqrt", Fx_sqrt, 0 },
{ "gray0", Fx_gray0, 0 },
{ NULL, 0, 0 } { NULL, 0, 0 }
}; };
@ -59,6 +60,10 @@ puts("------ fimg special effects ------");
puts("usage:"); puts("usage:");
puts("\tfimgfix [options] <effect> source.fimg resultat.fimg"); puts("\tfimgfix [options] <effect> source.fimg resultat.fimg");
puts("options:");
puts("\t-k N.N\tset the floating value");
puts("\t-v\tincrease verbosity");
puts("effects:"); puts("effects:");
printf("\t"); printf("\t");
for (fx=fx_list; fx->name; fx++) { for (fx=fx_list; fx->name; fx++) {
@ -103,6 +108,10 @@ switch (act) {
case Fx_sqrt: case Fx_sqrt:
fimg_square_root(&src, &dest, maxval); break; 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: default:
fprintf(stderr, "*** %s : %d is bad action\n", __func__, act); fprintf(stderr, "*** %s : %d is bad action\n", __func__, act);
break; break;