Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible issue in mix_colors (helpers.c) #185

Open
teadrinker opened this issue Feb 4, 2022 · 0 comments
Open

possible issue in mix_colors (helpers.c) #185

teadrinker opened this issue Feb 4, 2022 · 0 comments

Comments

@teadrinker
Copy link

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant