[cairo] PyCairo crashes
Gerdus van Zyl
gerdusvanzyl at gmail.com
Sun Nov 15 03:22:23 PST 2009
The line
self.surface2 =
cairo.ImageSurface.create_for_data(self.surface,cairo.FORMAT_ARGB32,
self.width, self.height, stride)
is very suspect since the first argument isn't a surface but a buffer/data.
Does it work if you just use self.surface.write_to_png(self.basename)?
2009/11/15 Simon Bächler <sbaechler at me.com>:
> Hi
>
> I'm experiencing a strange crash using PyCairo. I have tried different
> version of PyCairo and Cairo. The most recent ones were Pycairo 1.8.9
> and Cairo 1.9.2.
>
> When I execute the code Python crashes. Always.
>
> The function that causes the crash is surface2.write_to_png(self.basename).
> When I replace self.basename with a string such as "output.png" it
> works. Even though self.basename is a string as well.
>
>
> Here is a code snippet:
>
> self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, self.width,
> self.width)
> cr= self.cr = cairo.Context(self.surface)
> cr.scale(self.width, self.width)
>
> os.chdir(self.dirname)
>
> stride = cairo.ImageSurface.format_stride_for_width
> (cairo.FORMAT_ARGB32, self.width)
> self.surface2 = cairo.ImageSurface.create_for_data(self.surface,
> cairo.FORMAT_ARGB32, self.width, self.height, stride)
> self.surface2.write_to_png(self.basename)
>
>
> Regards
> Simon
>
>
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
More information about the cairo
mailing list