Surface.setMimeData - multiple declarations

Function Surface.setMimeData

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.

Prototype

void setMimeData(
  string type,
  ubyte* data,
  ulong length,
  extern(C) void function(void*) destroy,
  void* closure
);

Caution

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

Parameters

NameDescription
mime_type the MIME type of the image data
data the image data to attach to the surface
length the length of the image data
destroy 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.
closure the data to be passed to the destroy notifier

Throws

OutOfMemoryError if a slot could not be allocated for the user data.

TODO

More D-like API

Note

Only use this if you know what your doing! Make sure you get memory management of the passed in data right!

Function Surface.setMimeData

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.

Prototype

void setMimeData(
  string type,
  ubyte* data,
  ulong length,
  extern(C) void function(void*) destroy,
  void* closure
);

Caution

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

Parameters

NameDescription
mime_type the MIME type of the image data
data the image data to attach to the surface
length the length of the image data
destroy 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.
closure the data to be passed to the destroy notifier

Throws

OutOfMemoryError if a slot could not be allocated for the user data.

TODO

More D-like API

Note

Only use this if you know what your doing! Make sure you get memory management of the passed in data right!

Authors

Johannes Pfau cairoD
Andrej Mitrovic cairoD
cairo team cairo

Copyright

License

cairoD wrapper/bindings Boost License 1.0
cairo LGPL 2.1 / MPL 1.1