Quote:
Originally Posted by StainlessS
EDIT: Or in full as here: (3 out of the 4 original lines look messed up to me)
Code:
//RGB:
if constexpr(mode == LIGHTEN) {
alpha = luma_ovr > (luma_src + thresh) ? alpha : 0; // As original
} else { // EDIT: DARKEN
alpha = luma_ovr < (luma_src - thresh) ? alpha : 0
}
//YUV:
if constexpr (mode == LIGHTEN) {
alpha_mask = ovr > (src + thresh) ? level : 0;
}
else { // EDIT: DARKEN
alpha_mask = ovr < (src - thresh) ? level : 0;
}
|
I spent too much time yesterday with not understanding what really happens and why my code produces different results than existing rgb version. I was thinking it over by a bottle of dark Staropramen
and finally voted for this very same logic.
"Where overlay is brigher by threshold" =>
Where overlay is brigther by 10 =>
Where overlay > src + 10
and "Where overlay is darker by threshold" =>
Where overlay is darker by 10 =>
Where overlay < src - 10