sammycage / plutosvg

Tiny SVG rendering library in C
MIT License
247 stars 17 forks source link

[Requirement] export parse path function #5

Closed ZhUyU1997 closed 1 month ago

ZhUyU1997 commented 2 years ago

I am developing the canvas js API based on plutovg and quickjs. Path2D can receive SVG path. So I want this library to implement it. Reference: https://developer.mozilla.org/zh-CN/docs/Web/API/Path2D/Path2D

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

var p = new Path2D("M10 10 h 80 v 80 h -80 Z");
ctx.fill(p);

Can we export parse_path function? It could be like the below.

plutovg_path_t *plutosvg_parse_path(const char *path, size_t len)

Thanks, Yu Zhu

sammycage commented 2 years ago

I will see what I can do <3

sammycage commented 1 month ago

See https://github.com/sammycage/plutovg/blob/832a378edbeae98cfa984e030a9120ef671bf362/include/plutovg.h#L145