PNG Support

PNG Support — Reading and writing PNG images

Synopsis




cairo_status_t (*cairo_read_func_t)         (void *closure,
                                             unsigned char *data,
                                             unsigned int length);
cairo_status_t (*cairo_write_func_t)        (void *closure,
                                             unsigned char *data,
                                             unsigned int length);

Description

Details

cairo_read_func_t ()

cairo_status_t (*cairo_read_func_t)         (void *closure,
                                             unsigned char *data,
                                             unsigned int length);

cairo_read_func_t is the type of function which is called when a backend needs to read data from an intput stream. It is passed the closure which was specified by the user at the time the read function was registered, the buffer to read the data into and the length of the data in bytes. The read function should return CAIRO_STATUS_SUCCESS if all the data was successfully read, CAIRO_STATUS_READ_ERROR otherwise.

closure : the input closure
data : the buffer into which to read the data
length : the amount of data to read
Returns : the status code of the read operation

cairo_write_func_t ()

cairo_status_t (*cairo_write_func_t)        (void *closure,
                                             unsigned char *data,
                                             unsigned int length);

cairo_write_func_t is the type of function which is called when a backend needs to write data to an output stream. It is passed the closure which was specified by the user at the time the write function was registered, the data to write and the length of the data in bytes. The write function should return CAIRO_STATUS_SUCCESS if all the data was successfully written, CAIRO_STATUS_WRITE_ERROR otherwise.

closure : the output closure
data : the buffer containing the data to write
length : the amount of data to write
Returns : the status code of the write operation