samizdatco / skia-canvas

A GPU-accelerated 2D graphics environment for Node.js
MIT License
1.72k stars 67 forks source link

Publish skia bindings with canvas-like API to crates #51

Open Milo123459 opened 3 years ago

Milo123459 commented 3 years ago

This seems like the perfect place to put this feature request, and would be an amazing feature to have. A node-canvas like API in Rust, powered by Skia.

Milo123459 commented 2 years ago

Any updates? Cc @samizdatco

samizdatco commented 2 years ago

It's definitely easier said than done since the canvas API exists as much in the Javascript-interfacing code as in the underlying Rust objects (which present an abstraction much closer to Skia itself). And, as the folks at rust-skia mentioned, the interface offered by Skia is deeply canvas inspired as it is—plus the skia-safe API is much more idiomatically Rust-like than a port of the the Javascript API could be.

If anyone is interested in prototyping out what a Rust ‘canvas’ API could look like I'd be glad to look it over, but for now I'm having trouble seeing what it would offer that rust-skia does not.


Also: have you looked at Piet? It's not canvas, but it offers a simple and extremely Rust-ian approach to programmatic drawing.

Milo123459 commented 2 years ago

I'll have a look at piet, thanks! I just think having a similar API would be useful.