add zero shift to fimgfx

This commit is contained in:
tth 2022-01-31 20:26:45 +01:00
parent 6aa802fde2
commit db7b740b2c

View File

@ -28,7 +28,7 @@ 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_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
Fx_absolute, Fx_clamp };
Fx_absolute, Fx_clamp, Fx_shiftZ };
Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 },
@ -52,6 +52,7 @@ Fx fx_list[] = {
{ "hilightr", Fx_hilight_R, 0, 1 },
{ "abs", Fx_absolute, 0, 1 },
{ "clamp", Fx_clamp, 0, 1 },
{ "shiftzero", Fx_shiftZ, 0, 1 },
{ NULL, 0, 0, 0 }
};
@ -131,7 +132,8 @@ for (fx=fx_list; fx->name; fx++) {
}
}
puts("\n");
fimg_print_version(1);
if (lvl) fimg_print_version(1);
exit(0);
}
/* --------------------------------------------------------------------- */
@ -162,7 +164,7 @@ if (fx_list[fxidx].flags & 1) {
}
}
else {
fprintf(stderr, "%s: ???\n", __func__); /* XXX */
fprintf(stderr, "%s: flags & 1 ???\n", __func__); /* XXX */
memset(&dest, 0, sizeof(dest));
return -888;
}
@ -245,6 +247,14 @@ switch (action) {
negative pixels killed */
if (foo > 0) foo = 0;
break;
case Fx_shiftZ:
foo = fimg_auto_shift_to_zero(&src, &dest);
if (foo) {
fprintf(stderr, "*** shiftzero -> %d\n", foo);
}
break;
default:
fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action);
@ -277,12 +287,13 @@ char *operator;
char *srcname = "";
char *dstname = "out.fimg";
while ((opt = getopt(argc, argv, "hk:lv")) != -1) {
while ((opt = getopt(argc, argv, "hk:lvx")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break;
case 'l': list_of_effects(); exit(0);
case 'v': verbosity++; break;
case 'x': break;
}
}