Brooooooklyn / canvas

High performance skia binding to Node.js. Zero system dependencies and pure npm packages without any postinstall scripts nor node-gyp.
https://vercel.skia.rs
MIT License
1.78k stars 76 forks source link

Proposal: Mirror basic nodecanvas interface #123

Open asturur opened 3 years ago

asturur commented 3 years ago

Mirroring the basic node-canvas interface, has already done with createCanvas function, could be a great boost to adoption, especially for JSDOM.

Brooooooklyn commented 3 years ago

@asturur hey, storkeText and fillText are ready now, feel free to play with it. Note the maxWidth and measureText is still in developing.

The maxWidth has been implemented.

asturur commented 3 years ago

yes i want to resume this test. I see that skia canvas also has been updated, how this package relate to the other? is skia-canvas a dependency of this one?

Brooooooklyn commented 3 years ago

I see that skia canvas also has been updated, how this package relate to the other? is skia-canvas a dependency of this one?

No, skia-canvas is depended on rust-skia, another skia library created by me.

This project is depended on skia from scratch, because rust-skia was designed for more general usage, like rendering on OpenGL and Vulkan API, modify the build config on it is very complicated. So I started this project and build skia for only offscreen rendering usage, and also without any system dependencies!

The major differences between this project and skia-canvas is:

  1. skia canvas support more features now, because rust-skia has done the most of jobs. But skr-canvs (this project) will provide the same extra features in future if needed.
  2. skr-canvas has 0 system dependencies, so it's out of box solution for docker users. But skia-canvas dependent on fontconfig.
  3. skr-canvas support more platforms and CPU arch. Like I said below, modify the build config of rust-skia is very hard, so skia-canvas now only support linux-x64-gnu windows-x64 macOS-x64 and macOS-arm64. But skr-canvas support more wildly used platforms and CPU arch. Like linux-x64-musl which is very import for node:lts-apline users, and linux-arm64-gnu and linux-arm64-musl, which is important for users who is using m1 chip macOS with docker.
Brooooooklyn commented 3 years ago

And this project is dependent on skia directly, so the performance is better than the other implementations: https://github.com/Brooooooklyn/canvas#performance