[cairo] Pycairo + Pygame

James Mills prologic at shortcircuit.net.au
Thu Oct 13 02:52:08 PDT 2005


On Thu, Oct 13, 2005 at 06:39:26AM +0800, Steve Chaplin wrote:
> You can already do that with something like this:
> 
> import array
> import cairo
> width, height = 30*16, 30*9
> data = array.array('c', 'a' * width * height * 4)
> stride = width * 4
> surface = cairo.ImageSurface.create_for_data (data, cairo.FORMAT_ARGB32,
>                                               width, height, stride);
> 
> 'data' is a Python array object which supports the read/write buffer
> protocol. It holds the cairo surface pixel-data in premultiplied ARGB32
> format, can Pygame read that format?

Not sure, but I'll give it a go and let you know ;)

cheers
James

-- 
--
-"Problems are Solved by Method"
-
- James Mills <prologic at shortcircuit.net.au>
- HomePage: http://shortcircuit.net.au/~prologic/
- Phone: +61732166379
- Mobile: +61404270962
- Skype: therealprologic
- MSN: prologic at shortcircuit.net.au
- ICQ: 98888663
- IRC: irc://shortcircuit.net.au#se

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


More information about the cairo mailing list