Surface.writeToPng

cairo.types.Status writeToPng(string filename)

Writes the contents of surface to a new file filename as a PNG image.

Parameters

filenamethe name of a file to write to; on Windows this filename is encoded in UTF-8.

Returns

[cairo.types.Status.Success] if the PNG file was written

successfully. Otherwise, [cairo.types.Status.NoMemory] if memory could not be allocated for the operation or [cairo.types.Status.SurfaceTypeMismatch] if the surface does not have pixel contents, or [cairo.types.Status.WriteError] if an I/O error occurs while attempting to write the file, or [cairo.types.Status.PngError] if libpng returned an error.