[cairo] Pycairo + Pygame
Steve Chaplin
stevech1097 at yahoo.com.au
Thu Oct 13 16:57:03 PDT 2005
On Thu, 2005-10-13 at 21:20 +1000, James Mills wrote:
> 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
The latest release was on Tuesday this week - Pycairo 1.0.2. It adds the
new method cairo.ImageSurface.create_for_data().
See http://cairographics.org/releases/
Steve
Send instant messages to your online friends http://au.messenger.yahoo.com
More information about the cairo
mailing list