Surface.writeToPng

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

class Surface
writeToPng
(
string filename
)

Parameters

filename string

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

Return Value

Type: cairo.types.Status

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.