[cairo] Transparency troubles with PNGs on Windows

Owen Taylor otaylor at redhat.com
Mon Mar 12 06:05:35 PDT 2007

[ Sorry for the last mail, hit send accidentally ]

On Mon, 2007-03-12 at 01:42 +0000, Brad Elliott wrote:
> Hello,
> I'm trying to create transparent PNGs and I'm running into a problem
> where the surface doesn't get cleared when I destroy a cairo+surface
> pair under Windows. Then when I create a second object there is data
> left around (a red rectangle) from the original cairo object which
> corrupts the second image. I suspect that I'm tearing down something
> incorrectly and the reference counts don't drop to zero
> (cairo_surface_get_reference_count() doesn't seem to be available on
> the Windows build on Tor Lillquist's page). Has anyone encountered
> this before?

It's really very simple (I think) with older version's of Cairo an image
surface isn't cleared or initialized in any way when it's created. You
need to do that yourself;
e.g. with:

 cairo_set_operation(cr, CAIRO_CLEAR);

That was changed more "recently" - see:


You don't say what version of the Windows library you are using, but
perhaps you are using something quite old?

					- Owen

More information about the cairo mailing list