Search code examples
pythonvectorcairopycairo

Rare PyCairo antialias getting directly the surface data


After create a Pycairo context and surface (ImageSurface) I get a diferent export results if I get directly from surface buffer

surface.get_data()

or from PNG export method

surface.write_to_png()

The context antialias flag is obviously the same and, yes, the get_data method result has antialiasing, but with much poorer quality. Why?

Thanks.


Solution

  • I answer myself, Cairo uses premultiplied color (ARGB) and GTK only it's able to manage true color (RGBA). Use it directly result in a display with gray fridges

    I could make the conversion manually, losing a lot of performace, obviously.