Are `juce::Colour` operations commutative?

An idle question until I have time to write code to probe this, but since someone with more graphics experience than I have may know the answer to this already:

Is the order in which mutating operations on a Colour are performed significant?

E.g., given:


juce::Colour original{Colours::whatever);
auto c1 = original.withAlpha(0.4f).withRotatedHue(0.4f).withBrightness(0.8f);
auto c2 = original.withBrightness(0.8f).withRotatedHue(0.4f).withAlpha(0.4f);
assert(c1 == c2);

will that assertion pass or fail, and will it do so for all input values (and for all possible sequences of operations)?

1 Like

They’re not commutative in general for sure.

auto c1 = origin.withAlpha (0.0f).withAlpha (1.0f);
auto c2 = origin.withAlpha (1.0f).withAlpha (0.0f);

Should these two be the same? Obviously not. But I’d expect changes to alpha and hue to be independent and thus commutative.