the MIME type of the image data
the image data to attach to the surface
a cairo_destroy_func_t which will be called when the surface is destroyed or when new image data is attached using the same mime type.
the data to be passed to the destroy notifier
CAIRO_STATUS_SUCCESS or CAIRO_STATUS_NO_MEMORY if a slot could not be allocated for the user data.
Attach an image in the format mime_type to surface. To remove the data from a surface, call this function with same mime type and NULL for data. The attached image (or filename) data can later be used by backends which support it (currently: PDF, PS, SVG and Win32 Printing surfaces) to emit this data instead of making a snapshot of the surface. This approach tends to be faster and requires less memory and disk space. The recognized MIME types are the following: CAIRO_MIME_TYPE_JPEG, CAIRO_MIME_TYPE_PNG, CAIRO_MIME_TYPE_JP2, CAIRO_MIME_TYPE_URI. See corresponding backend surface docs for details about which MIME types it can handle. Caution: the associated MIME data will be discarded if you draw on the surface afterwards. Use this function with care. Since 1.10