The problem is that you are writing a compressed PNG data file into the
buffer. The pygame 'fromstring' and 'frombuffer' functions expeect a
string with raw pixel data.
I've lurked on the cairo list every once in awhile, I'm pretty sure there is a way to get this type of string from the cairo surface.
I've found a thread[1] that turns into a discussion about more or less exactly what I want to do, but it appears no one ever actually got what I am trying to do to work. I couldn't find any way to write a "raw" PNG (if that is even what it is called) out with pycairo, though I am sure it is possible using cairo's C api.
I may hack around with the pycairo code a bit to see if I can add the functionality myself.
[1]http://lists.freedesktop.org/archives/cairo/2005-October/005452.html __ Trevor Fancher http://fancher.org/
Attachment:
smime.p7s
Description: S/MIME cryptographic signature