#cairo #draw #svg #surfaces #syntax #conversion #compile-time

nightly macro cairo-svgpath

Draw on cairo surfaces using SVG path syntax, with compile-time parsing and conversion

2 releases

0.1.1 Feb 4, 2019
0.1.0 Feb 3, 2019

#45 in #cairo

MIT license

9KB
184 lines

cairo-svgpath

Draw on cairo surfaces using SVG path syntax, with compile-time parsing and conversion.

use cairo_svgpath::svgpath;

fn before(ctx: &cairo::Context) {
	ctx.move_to(1, 2);
	ctx.line_to(3, 4);
	ctx.curve_to(5, 6, 7, 8, 9, 10);
}

fn after(ctx: &cairo::Context) {
	svgpath!(ctx, "M1 2L3 4C5 6 7 8 9 10");
}

Dependencies

~3MB
~76K SLoC