Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
61–70 of 91 posts
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#62https://windowjs.org is a very similar concept -- it wraps Skia and exposes it as the Canvas API, but also embeds v8 for a very small runtime instead of using Node. It was my first open-source project, released about 3 years ago. I had plans to also expose WebGL, audio, etc and make it a viable platform for Javascript-based games on desktop. Life and other projects happened instead, and development was discontinued.…
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#63Out of curiosity, what's the use for such library? If you are on a desktop surely there is a better native library to draw shapes, no?
At Soundslice, we have a custom sheet-music-rendering graphics library in frontend JavaScript/Canvas. We also need to generate vector PDFs serverside — so we use a node library that speaks the HTML Canvas API and can generate PDFs. This way the result is exactly the same as the rendered sheet music in the web browser. Nice! The upshot is: this kind of library allows for code reuse in non-browser contexts.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#64Are there plans for a C API? The missing C API for Skia is most likely why Cairo is still alive.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#65Earlier quoted context omitted.
Note that it's not so much "rust bindings" as a pre-compiled node binary (that happens to be generated off of a mixed Rust/C++ codebase). So that's really the main difference: WASM needs a separate runtime, whereas a node binary doesn't.
> WASM needs a separate runtime, whereas a node binary doesn't. FWIW, node ships with a WASM runtime. See https://nodejs.org/en/learn/getting-started/nodejs-with-weba...
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#66Are there plans for a C API? The missing C API for Skia is most likely why Cairo is still alive.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#67Earlier quoted context omitted.
The only similarity between the two is that they deal with images. That library only resizes and does other basic pixel level operations. Skia is for drawing vector graphics.
> Skia is for drawing vector graphics. What do you mean by "vector graphics"? Both Canvas and ImageData work only with pixels.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#68Out of curiosity, what's the use for such library? If you are on a desktop surely there is a better native library to draw shapes, no?
One the one hand this is lower-level. On the other hand, I've used puppeteer as my 2D graphics library. I get Canvas 2D, and WebGL, and WebGPU, and all of HTML/CSS (so Text with effects, background images, CSS transforms, etc). I get image and video loading. I can then use the screenshot functionality to make an image of whatever I put together. It's overkill, but for my use case I don't care. It works, it's cross platform, it solves my problem.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#69https://windowjs.org is a very similar concept -- it wraps Skia and exposes it as the Canvas API, but also embeds v8 for a very small runtime instead of using Node. It was my first open-source project, released about 3 years ago. I had plans to also expose WebGL, audio, etc and make it a viable platform for Javascript-based games on desktop. Life and other projects happened instead, and development was discontinued.…
That’s pretty cool! But v8 alone kind of sucks unless you specifically want isolation. Sometimes you just want to make a network request, you know?
In a drawing tool / library?
That's just asking for trouble. By spec, SVG allows for XXE shenanigans. I'd rather not worry that any image file I process might exfiltrate my data.
Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node
#70https://windowjs.org is a very similar concept -- it wraps Skia and exposes it as the Canvas API, but also embeds v8 for a very small runtime instead of using Node. It was my first open-source project, released about 3 years ago. I had plans to also expose WebGL, audio, etc and make it a viable platform for Javascript-based games on desktop. Life and other projects happened instead, and development was discontinued.…
> but also embeds v8 for a very small runtime instead of using Node.
By how much does embedding just V8 instead of using Node.js decrease the binary size? Node.js uses V8, does most of Node's binary size come from its runtime and not V8?
I tried browsing the website and GitHub repo to find how many kBs or MBs typically is a Window.js binary, but didn't find an answer.