[cairo] Not sure how to handle MIME in my go binding

jimmy frasche soapboxcicero at gmail.com
Sat May 10 14:13:12 PDT 2014


I think I want to add MIME support to my binding but I'm not entirely
sure what it's purpose or function is and completely unsure what the
use-cases for it are.

The docs for cairo_surface_set_mime_data say,

"The attached image (or filename) data can later be used by backends
which support it […] to emit this data instead of making a snapshot of
the surface.

"Caution: the associated MIME data will be discarded if you draw on
the surface afterwards. Use this function with care."

I'm reading this as saying that this is essentially a way of painting
an image surface as a surface pattern, specially optimized to avoid
decoding the image data, and without the ability to do anything
afterwards.

Can you, say, use this to embed an image in a PS surface by creating
two PS surfaces, attaching the mime data to one to use as a surface
pattern on the other, which you can then use as you normally would?
(Do they both have to be PS surfaces?)

I also see talk of a mime surface, searching the mailing list
archives, but the only references in the source I see are:

$ find -name "*.[ch]" | xargs grep -in mime_surface
./src/cairo.c:220: *  writing (such as #cairo_mime_surface_t) then a
./test/mime-surface-api.c:146:CAIRO_TEST (mime_surface_api,

Was this never implemented or did it just become the present mime data api?

If so, the documentation for cairo_create's return should be amended.

I'd like to expose this functionality idiomatically and clearly
documented, so any help increasing my undersanding would be
appreciated.

If this conversation leads to any way to clarify the current
documentation I'm more than happy to put together patches for the API
docs.


More information about the cairo mailing list