summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlexander Shulgin <alex.shulgin@gmail.com>2010-02-20 20:59:32 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2010-03-02 10:07:19 +0000
commit15d9c5fcd8881b4593ec23633450a4f629b6d42b (patch)
treec21722577e1d1efcd8358f1c6e6e189c8699b822 /doc
parentd91bab565c54205f8dd7aa8a9de819dc4bc3551c (diff)
Added new MIME type CAIRO_MIME_TYPE_URI and it's support in SVG backend
The rationale behind this change is that when someone is trying to draw on a SVG surface using image surface patterns, the resulting SVG file can take up to ridiculous 20 megabytes for 3-4 typical photographic images in a single SVG file. This also can take significant amount of CPU time to complete. The reason for this behaviour is that currently whenever SVG backend needs to emit an image tag for a surface pattern it takes a snapshot of the subject surface, encodes it in PNG, then Base64-encodes and emits the (huge) resulting string. With use of cairo_surface_set_mime_data API this can be somewhat improved by associating JPEG image contents with the corresponding surfaces. Still this doesn't allow for post-processing of involved photographic images without regenerating the SVG file. As SVG specification allows URIs in the image tag's xlink:href attribute, it is possible instead of embedding encoded image data to simply link image files residing physically on the same medium as the generated SVG file: files on disk under common directory, files on a web server at common base URI, etc. To make this happen we add new (unofficial) MIME type "text/x-uri" and let users associate URIs with surfaces through cairo_surface_set_mime_data() API. When SVG backend needs to emit surface contents and it sees "text/x-uri" attached to the surface, it emits this data instead of taking snapshot. The URI data is emitted as is, so correctness check is left solely to the client code.
Diffstat (limited to 'doc')
-rw-r--r--doc/public/cairo-sections.txt1
-rw-r--r--doc/public/tmpl/cairo-surface.sgml7
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 302ffa02f..24ae745dc 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -176,6 +176,7 @@ cairo_svg_version_to_string
CAIRO_MIME_TYPE_JP2
CAIRO_MIME_TYPE_JPEG
CAIRO_MIME_TYPE_PNG
+CAIRO_MIME_TYPE_URI
cairo_surface_t
cairo_content_t
cairo_surface_create_similar
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index 4503e40f7..c1445f7bb 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -48,6 +48,13 @@ The Portable Network Graphics image file format (ISO/IEC 15948). Since 1.10
+<!-- ##### MACRO CAIRO_MIME_TYPE_URI ##### -->
+<para>
+URI for an image file (unofficial MIME type). Since 1.10
+</para>
+
+
+
<!-- ##### TYPEDEF cairo_surface_t ##### -->
<para>