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

Stuart Axon stuaxo2 at yahoo.com
Thu May 6 16:47:32 UTC 2021


Gah, immediately hit an edge-case will open a ticket anyway.

S++ 

    On Thursday, May 6, 2021, 5:23:30 PM GMT+1, Stuart Axon <stuaxo2 at yahoo.com> wrote:  
 
 The fantastic, @cassiecodes on twitter has found a solution to this using paint order stroke, it seems like a longer term solution is inset or offset strokes.

https://twitter.com/cassiecodes/status/1390338810911862790SVG transparent stroke.

| 
| 
| 
|  |  |

 |

 |
| 
|  | 
SVG transparent stroke.

...
 |

 |

 |



Now there's a solution I'll open bug for this.

S++ 

    On Thursday, March 25, 2021, 5:55:04 PM GMT, Stuart Axon <stuaxo2 at yahoo.com> wrote:  
 
 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.


S++ 

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

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

Cheers,
Uli
-- 
Homophobia - The fear that another man will treat you the way you treat
women.
      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20210506/17c18fe3/attachment-0001.htm>


More information about the cairo mailing list