Skip to content

possible issue in mix_colors (helpers.c) #185

@teadrinker

Description

@teadrinker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions