mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-24 21:50:19 +01:00
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. |
||
|---|---|---|
| .. | ||
| public | ||
| tutorial | ||
| .gitignore | ||
| Makefile.am | ||