[cairo] Lander Game

Alex Mac lots.of.mailing.lists at gmail.com
Tue Jan 9 06:46:10 PST 2007


On 09/01/07, Thomas Dybdahl Ahle <lobais at gmail.com> wrote:
> 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'

it isn't a static method you need to call create_similar() on an
already existing surface, have a look in the latest version of my
lander game for an example

> 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
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
>


More information about the cairo mailing list