[cairo] Output SVG with fill and alpha stroke, but without inline images ?

Stuart Axon stuaxo2 at yahoo.com
Thu Mar 25 17:55:04 UTC 2021

Thanks for looking at this.
Specifying the version, I can see the same result.  It seems likely there is a way to achieve the expected output, but I think I need to understand SVG a bit more first.   

I failed on my first pass understanding the filter dialog in Inkscape but will try again from that end, or just editing the raw SVG.


    On Thursday, March 25, 2021, 4:06:43 PM GMT, Uli Schlachter <psychon at znc.in> wrote:  

Am 24.03.21 um 02:22 schrieb Stuart Axon:
> I've been trying to generate an SVG using SVGSurface with a fill and an alpha stroke, 
> with OPERATOR_SOURCE to ensure the stroke draws over the fill, but this seemsto generate <image> tags in the SVG.
> Toy example and output + XML:
> https://gist.github.com/stuaxo/b525a47d33f5f3074b1be7c693f6b6e6
> Is there any way to render fill + stroke (with alpha) and only output vector data ?This seems like a common operation, but whatever I try outputs SVGs full of <image>s.
> For Shoebot, this has meant our SVGs become very very large, enough to eat all your ram if you try and open them in Inkscape.

I ported your example code to C (attached). Don't ask me why, but I
experimented with the SVG version. And it helped!

More specifically, adding this line:

  cairo_svg_surface_restrict_to_version(s, CAIRO_SVG_VERSION_1_2);

...causes a small difference in the output with/without operator SOURCE:
The path's style gets a new "comp-op:src;clip-to-self:true" entry.
Everything else stays the same (well, except the header saying
version="1.2" instead of the previous version="1.1").

So, I do not really have much clue about SVG, but I guess this means that:
- cairo defaults to SVG 1.1
- SVG 1.1 does not support operator SOURCE

Homophobia - The fear that another man will treat you the way you treat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20210325/a34b2989/attachment.htm>

More information about the cairo mailing list