- Notifications
You must be signed in to change notification settings - Fork3.9k
Description
It would be good if image_frombuffer could understand pycairos premultiplied ARGB32 format, currently it seems impossible to use, as pygame is doing some byteswapping and it's not obvious how to enable alpha premultiplication.
In detail:
@hanysz found an interesting issue using pycairo to create surfaces for pygamepygobject/pycairo#247
Cairos ARGB32 format stores ARGB starting in the high byte, with alpha premultiplied.
Thedocs make it look like image_frombuffer should be able to handle this format, but unfortunately there is some
undesired byteswapping happening.
Theimplementation calls SDL_CreateRGBSurfaceFrom, which looks like it could be given the right parameters to understand the format.
@hanysz test prog creates an image in cairo, rendering text in red, green and blue and renders in pygame - but only the "red" text is output, in blue:
The feature request:
Possibly this needs a new format: native endian RGBA32 with alpha premultiplication, or maybe it's a matter of providing a method of disabling the byteswapping.
