Give Gdk::RGBA an RGBA(r, g, b) constructor
There's no way to construct a Gdk::RGBA
directly from components; we must either default-construct and then set_rgba()
or do the more expensive thing of constructing from a string specifying the components.
So, to conveniently construct palettes, i.e. std::vector<Gdk::RGBA>
, I have to provide my own helper make_rgba(double r, double g, double b, double a = 1)
, which ends up being a lot more verbose than being able to just write vector<RGBA>{ {1, 0, 0}, {0, 1, 0}, {0, 0, 1} }
Would it make sense to add an RGBA(double r, double g, double b)
constructor, corresponding to set_rgba()
? I'm assuming that's the one people will want most.
However, there is also set_rgba_u()
taking gushort
s, which people might want, but could be quite ambiguous/unintuitive overloading with the double
version. If we wanted to be able to construct from both representations of components, I guess we would need something like tagged constructor(s) or create_rgba[_u]()
functions.
Maybe a lack of consensus on how to resolve that is why no such ctors were ever added, but I couldn't find any discussion, so it seems worth asking.