Hello, You can use my SDL_Surface.py hack to get a ctypes pointer to the pixel data. http://www.thousandparsec.net/repos/libmng-py/mng/pygame/
I needed this to make libmng-py as fast as possible. Hope this helps! Tim Ansell On Sat, 2006-12-16 at 14:49 +0100, Jakub Piotr Cłapa wrote: > 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. >
