added gray conversion to fimgfx
This commit is contained in:
parent
0104a736ea
commit
360c2e113a
@ -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;
|
||||
|
@ -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] <effect> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user