[cairo] Corrupted image surface in pycairo 1.0.2

Sebastian Koppehel basti at bastisoft.de
Sun Jul 23 16:33:49 PDT 2006


Hi,

the following Python program produces an empty, transparent image as
expected:

   import cairo
   
   t = cairo.ImageSurface(cairo.FORMAT_ARGB32, 180, 180)
   t.write_to_png("bla.png")

The following produces, on my system, a mostly empty image, but with
stray pixels:

   import cairo
   
   s = cairo.ImageSurface.create_from_png("knight.png")
   t = cairo.ImageSurface(cairo.FORMAT_ARGB32, 180, 180)
   t.write_to_png("bla.png")

It's the unrelated loading of another image which causes the corruption;
it does depend on the other image and on the dimensions of t. There are
sizes of t where it doesn't get corrupted at all.

For reference, here are my image files:

http://bastisoft.de/temp/knight.png
http://bastisoft.de/temp/bla.png

>>> cairo.version, cairo.cairo_version_string()
('1.0.2', '1.0.4')

Unfortunately I cannot test newer versions of pycairo at the moment. I
currently work around this by explicitly clearing the surface:

   cr = cairo.Context(t)
   cr.set_operator(cairo.OPERATOR_SOURCE)
   cr.set_source_rgba(0, 0, 0, 0)
   cr.paint()

But I figure I shouldn't have to do this.

 - Sebastian




More information about the cairo mailing list