[cairo] jpeg

Adrian Johnson ajohnson at redneon.com
Sun Sep 7 04:52:32 PDT 2008

One of the things we discussed during the cairo summit was how to pass 
jpeg and other compressed image formats though to backends that support 
these formats. The API function we came up with is:

#define CAIRO_MIME_TYPE_JPEG "image/jpeg"

cairo_surface_set_mime_data (cairo_surface_t		*surface,
                              const char			*mime_type,
                              const unsigned char	*data,
                              unsigned int		 length,
			     cairo_destroy_func_t	 destroy)

The mime_type specifies the format of the image data. The types 
supported by cairo will have a #define for convenience.

Also discussed during the summit was the need for a set properties API 
that can be used for setting things like meta data, compression level, 
and disabling subsetters. It was mentioned that the 
cairo_surface_set_mime_data() API could possibly be subsumed by the set 
properties API.

The cairo_surface_set_mime_data() API is intended be committed at the 
start of the 1.9 development cycle. This will allow plenty of time to 
develop the set properties API and decide whether to replace 
cairo_surface_set_mime_data() with a surface property for compressed 
image data.

I've put my patches for implementing this API at:


I've also included a cairo_surface_get_mime_data() function.

More information about the cairo mailing list