![]() |
![]() |
![]() |
Cairo: A Vector Graphics Library | ![]() |
---|
PNG BackendPNG Backend — |
cairo_surface_t* cairo_image_surface_create_from_png (const char *filename); cairo_surface_t* cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void *closure); cairo_status_t cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename); cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t *surface, cairo_write_func_t write_func, void *closure);
cairo_surface_t* cairo_image_surface_create_from_png (const char *filename);
Creates a new image surface and initializes the contents to the given PNG file.
filename : | name of PNG file to load |
Returns : | a new cairo_surface_t initialized with the contents of the PNG file or NULL if the file is not a valid PNG file or memory could not be allocated for the operation. |
cairo_surface_t* cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void *closure);
Creates a new image surface from PNG data read incrementally via the read_func function.
read_func : | function called to read the data of the file |
closure : | data to pass to read_func. |
Returns : | a new cairo_surface_t initialized with the contents of the PNG file or NULL if the data read is not a valid PNG image or memory could not be allocated for the operation. |
cairo_status_t cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename);
Writes the contents of surface to a new file filename as a PNG image.
surface : | a cairo_surface_t with pixel contents |
filename : | the name of a file to write to |
Returns : | CAIRO_STATUS_SUCCESS if the PNG file was written successfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could not be allocated for the operation or CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have pixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurs while attempting to write the file. |
cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t *surface, cairo_write_func_t write_func, void *closure);
Writes the image surface to the write function.
surface : | a cairo_surface_t with pixel contents |
write_func : | a cairo_write_func_t |
closure : | closure data for the write function |
Returns : | CAIRO_STATUS_SUCCESS if the PNG file was written successfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned if memory could not be allocated for the operation, CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have pixel contents. |
<< PDF Backend | PS Backend >> |