adding hilightR to fimgfx

This commit is contained in:
tth 2021-03-25 11:11:16 +01:00
parent 635b722635
commit 2cf45fdbe5
2 changed files with 23 additions and 10 deletions

View File

@ -6,7 +6,7 @@
# -----------------------------------------------------
TMPF="tmp.fimg"
TMPF="../funcs/in.fimg"
# -----------------------------------------------------
function essai_rot90
@ -47,7 +47,12 @@ function essai_contour
./fimgfx -vv ctr2x2 $TMPF bar.fimg
}
# -----------------------------------------------------
function essai_hilight
{
./fimgfx -vv hilightr $TMPF bar.fimg
}
# -----------------------------------------------------
essai_contour
essai_hilight
# -----------------------------------------------------

View File

@ -22,7 +22,7 @@ typedef struct {
enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm,
Fx_xper };
Fx_xper, Fx_binarize, Fx_hilight_R };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 },
@ -37,7 +37,9 @@ Fx fx_list[] = {
{ "desat", Fx_desat, 0, 1 },
{ "ctr2x2", Fx_ctr2x2, 0, 1 },
{ "norm", Fx_norm, 0, 1 },
{ NULL, 0, 0 }
{ "binarize", Fx_binarize, 0, 0 },
{ "hilightr", Fx_hilight_R, 0, 1 },
{ NULL, 0, 0, 0 }
};
/* --------------------------------------------------------------------- */
@ -111,7 +113,7 @@ fimg_print_version(1);
exit(0);
}
/* --------------------------------------------------------------------- */
int do_an_effect(char *sf, int fxidx, char *df)
int do_an_effect(char *srcfname, int fxidx, char *dstfname)
{
FloatImg src, dest;
int foo, action;
@ -119,12 +121,12 @@ double maxval;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %d '%s' )\n", __func__,
sf, action, df);
srcfname, action, dstfname);
#endif
foo = fimg_create_from_dump(sf, &src);
foo = fimg_create_from_dump(srcfname, &src);
if (foo) {
fprintf(stderr, "err load '%s' : %d\n", sf, foo);
fprintf(stderr, "err load '%s' : %d\n", srcfname, foo);
return foo;
}
@ -180,7 +182,13 @@ switch (action) {
case Fx_ctr2x2:
foo = fimg_contour_2x2(&src, &dest, 0);
break;
case Fx_binarize:
fimg_copy_data(&src, &dest);
foo = fimg_binarize(&dest, 0);
break;
case Fx_hilight_R:
foo = fimg_highlight_color(&src, &dest, 'R', 1.333);
break;
default:
fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action);
@ -188,7 +196,7 @@ switch (action) {
}
foo = fimg_dump_to_file(&dest, df, 0);
foo = fimg_dump_to_file(&dest, dstfname, 0);
if (foo) {
fprintf(stderr, "dumping datas to file give us a %d\n", foo);
return foo;