Support BGR colorspace
Currently, the only supported colorspace is RGB (as defined in gdk-pixbuf-core.h
), though with the qualifier that the docs/code state that is only currently the case. Some applications (say, those that deal with webcams) deliver their colors in BGR format. Since supporting the BGR format seems a small step from supporting RGB (partly because the infrastructure for dealing with different colorspaces is already in place), it seems reasonable and helpful to add support for creating BGR pixbufs.
I know I could attempt to change the colorspace before converting to a pixbuf, but in my case (a python application where every bit of performance matters), this is somewhat more cumbersome and slower than simply being able to use:
b = GLib.Bytes.new(img.tobytes())
pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(b, GdkPixbuf.Colorspace.BGR, False, 8, 1280, 720, 3840)