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

Carl Worth cworth at cworth.org
Thu May 6 18:46:48 UTC 2021


On Thu, May 06 2021, Stuart Axon 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.

You should be able to do what you are trying to in SVG by using a
group (that is, a <g> element). The group could be translucent and
contain a path that is both stroked and filled without any translucence,
(so you don't end up with the result you're currently seeing).

And you should be able to achieve a similar result in cairo with code
like:

        cairo_push_group (cr);

        /* Draw your stroke and filled shape here. */

        cairo_pop_group_to_source (cr);

        cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
        cairo_paint_with_alpha (cr, 0.5);

I'm not sure whether the above cairo operations map to clean <g> in SVG,
but if not, then maybe that's the cairo bug you're looking to file?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.cairographics.org/archives/cairo/attachments/20210506/25585cab/attachment.sig>


More information about the cairo mailing list