[cairo] Pycairo + Pygame

James Mills prologic at shortcircuit.net.au
Thu Oct 13 04:20:45 PDT 2005


On Thu, Oct 13, 2005 at 07:52:08PM +1000, James Mills wrote:
> > 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 ;)

$ ./ex1.py 
Traceback (most recent call last):
  File "./ex1.py", line 63, in ?
    main()
  File "./ex1.py", line 24, in main
    surface = cairo.ImageSurface.create_for_data(data,
cairo.FORMAT_ARGB32,
AttributeError: type object 'cairo.ImageSurface' has no attribute
'create_for_data'

Seems the current python bindings of cairo do not have this function :)

*sighs* I'll wait for the next release :)

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