This allows a style like this to compile: StylePtr<Layers<AlphaL<Blue,Int<16384>>, Red>>() and we just discard the first color and show the solid color.
But this will error at compile time: StylePtr<Layers<AlphaL<Blue,Int<16384>>, Red, AlphaL<Green,Int<16384>>>>()
I was looking at making some static assert error messages for the cryptic RGBA_um_nod& / DISAMBIGUATE_OVER errors, so I’m wondering if this should instead be:
Layers<> has nothing against transparent base layers. It allows it just fine. However, the result is transparent, which is not allowed for StylePtr<>
The line you point at only matches if the base layer is 100% transparent, it should not match the examples you provide, since they have Int<16384> instead of Int<0>.
LayerSelector gets recursively broken down, so if you have layers A, B, C, it becomes LayerSelector<LayerSelector<A, B>, C>, so it eventually always runs on pairs of layers.
Assuming I did it correctly, the line you point at is an optimization and should have no impact on what is allowed and what isn’t. (It does have an impact of which run() functions are executed though, which might not be expected.)
Have you actually tried your examples, or you just assuming that they will work or throw errors?
Yeah I tested with Int<0> and changed it for this post for whatever reason, and that was my undoing.
Duh it says right there in the template Int<0>.
So bottom line is since AlphaL<Blue,Int<0>> is nothing anyway, it can be discarded if it’s the first color. Other transparencies a solid are considered.
All good.
PR incoming.