[cairo] Lander Game

Thomas Dybdahl Ahle lobais at gmail.com
Tue Jan 9 06:30:54 PST 2007


man, 08 01 2007 kl. 18:38 -0500, skrev Behdad Esfahbod:
> class Surface(__builtin__.object)
>  |  Methods defined here:
>  |  
>  |  create_similar(...)
>     ^^^^^^^^^^^^^^^^^^^
> 
> It takes the same args as the C API: content, width, height.  Use
> cairo.CONTENT_COLOR_ALPHA for content.

surf = cairo.Surface.create_similar(cairo.CONTENT_COLOR_ALPHA, size,
size)
gives me
TypeError: descriptor 'create_similar' requires a 'cairo.Surface' object
but received a 'int'

Probably because it needs a surface to be similar to, but I simply get
the cairo context using
context = widget.window.cairo_create()

Where am I supposed to get a surface object??

But just to get on the technique. When I have created the surface, I use
context.set_source_surface(surf) and paint my stuff. Then I save the
surface somewhere, and next time I paint, I just
context.mote_to(somewhere); context.set_source_surface(surf);
context.fill() right?

-- 
Med venlig hilsen,
Best regards,
Thomas



More information about the cairo mailing list