[cairo] cairo_surface_set_mime_data

François Bianco francois.bianco at unige.ch
Thu Jun 13 06:09:52 PDT 2013


Hello,

I am currently trying to fix a bug in the PDF export of Inkscape which is using 
the Cairo lib for that. The current exporter code convert JPG file to bitmaps 
which results in heavy PDF files. I'd like to store the image data with mime 
type in the PDF.

Since it is my first use of Cairo, I started with a minimal example (attached). 
My example is working correctly, but it rises some questions to me:

1. Why is my code with 'cairo_image_surface_create' not displaying any image 
in the exported PDF ? as it does when creating a buggy image surface with 
'cairo_image_surface_create_for_data' fed with raw JPG data ? (see lines with 
fixme in code)

2. In the Cairo documentation for 'cairo_surface_set_mime_data', it is stated 
"Caution: the associated MIME data will be discarded if you draw on the 
surface afterwards. Use this function with care. "
Could one of you demonstrate (by changing my code) or explain me which cairo 
functions would cause a redraw of the surface which would finally results in 
loosing the MIME JPG data ? I ask that since I ported my example in Inkscape 
code, but the final output is always bitmaps. I am not able to locate which 
part of the code could cause this issue. I tried and implemented in my example 
a stupid rotation/scaling/translation to the image, but the surface is still 
perfectly exported with its jpg MIME data.


Thanks you for your help,
François Bianco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testmime.tar.gz
Type: application/x-compressed-tar
Size: 17401 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130613/d542df29/attachment-0001.bin>


More information about the cairo mailing list