Image filtering: apply "negative" before all other transformations

This commit is contained in:
Alexander Pevzner
2020-10-17 23:25:14 +03:00
parent cd0c5932ac
commit 0046d315bb
+2 -6
View File
@@ -79,17 +79,13 @@ filter_xlat_new (const devopt *opt)
filt->base.apply = filter_xlat_apply;
for (i = 0; i < 256; i ++) {
double v = i / 255.0;
uint8_t c;
uint8_t c = opt->negative ? (255 - i) : i;
double v = c / 255.0;
v = C * (v - 0.5) + 0.5 + B;
v = math_bound_double(v, 0.0, 1.0);
v = pow(v, 1/G);
if (opt->negative) {
v = 1 - v;
}
c = round(v * 255.0);
if (c <= shadow) {
c = 0;