[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] ARGB vs. RGBA



I was trying to make some data exported from cairo as a ARGB (literally in this byte order on my big-endian machine, A beign in the lowest address) buffer into a PyGame surface but run in to some problems.

The code which creates the bitmasks required by the SDL conversion routine does some really strange things.
For RGBA it takes the notation as a literal byte order in memory, low address first and simply swaps the 4 bytes on BE vs. LE.


The ARGB on the other hand assumes GBAR memory layout (low address first) on both little and big endians.

Is this intentional? Why doesn't the name reflect the actual memory layout? Cairo had some discussion whether the ARGB should express the memory address layout or the significance in a 32bit word but this issue seems disconnected from this case as PyGame is inconsistent even with itself here.

If this is intentional than are there any other means of creating a surface without intermediate string. Let's assume that i don't have to blit often (so that the conversion between the nativ format and ARGB won't be a problem) but I want to modify the surface from cairo and update the surface w/o copying it each time.

Thanks you in advance for any suggestions.