On Tuesday, 13 September 2016 at 09:31:53 UTC, Manu wrote:

In my lib, colours are colours. If you have `BGR8 x` and `RGB8 y`, and add them, you don't get x.b+y.r, x.g+y.g, x.r+y.b... that's not a colour operation, that's an element-wise vector operation.

I think swizzling is way overrated, especially swizzling assignment.


Which is the most readable?

    color.rb = color.br;     // swizzling
    swap(color.r, color.b);  // no swizzling

    auto color = RGBA8(c.rgb, 255);         // swizzling
    auto color = RGBA8(c.r, c.g, c.b, 255); // no swizzling

And finally:

    auto rb = color.rgrb; // When do you ever need that?

Reply via email to