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

Re: [pygame] ARGB vs. RGBA



Pete Shinners wrote:
On Fri, 2006-12-15 at 12:07 +0100, Jakub Piotr CÅapa wrote:
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.

I'm not sure the problem. Passing the mask arguments when creating surfaces should allow any byte orderedering.

size = 100, 100
rgba_mask = 0xff000000, 0xff0000, 0xff00, 0xff
rgba_surf = pygame.Surface(size, 0, 32, rgba_masks)

argb_mask = 0xff0000, 0xff00, 0xff, 0xff000000
argb_surf = pygame.Surface(size, 0, 32, argb_masks)

I was thinking about pygame.image.frombuffer which requires a string (and not an arbitrary bitmask tuple). I don't think pygame.Surface allows for creating surfaces out of arbitrary python buffers.


--
Regards,
Jakub Piotr CÅapa