mypaint/libmypaint

possible issue in mix_colors (helpers.c)

teadrinker opened this issue · 0 comments

I was comparing color blending functions and I noticed this one did not seem to be symmetrical
(swapping a,b and using 1-t instead if t, is expected to give the same result)

I think the reason is that this expression in helpers.c

opa_a * a[3] / (a[3] + b[3] * opa_b);

Should probably be

opa_a * a[3] / (opa_a * a[3] + b[3] * opa_b);

since blending.hpp from mypaint is using

Sa / (Sa + one_minus_Sa * dst[i+3] / (1<<15));

Not entirely sure since I translated the code to another language first,
but adding opa_a seem to solve the issue I was having, so I will just leave this here...