Tim Ansell wrote:
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.
Thanks but I'm unsure if this helps. I've got a Python buffer which is
already allocated by cairo and I want pygame to use it as an image I can
blit to screen later. This method is in the cookbook and should be fast
(no memory copying for cairo->pygame conversion).
It just that I don't understand why ARGB isn't just ARGB in memory (1
byte A, 1 byte R, 1 byte G and 1 byte B). Look at lines 627 and 629 in
src/image.c:
#v+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0xFF<<24, 0xFF, 0xFF<<8, 0xFF<<16);
#else
0xFF, 0xFF<<24, 0xFF<<16, 0xFF<<8);
#endif
#v-
The BIG_ENDIAN part should be 0xFF<<16, 0xFF<<8, 0xFF, 0xFF<<24; the
same as LIL just in reverse order.
--
regards,
Jakub Piotr Cłapa