Live data from Hacker News

Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

skia-canvas.org

51–60 of 91 posts

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#51
post #33
post #5

Huh, it's more than just a rendering API: "can render to windows using an OS-native graphics pipeline and provides a browser-like UI event framework". They could add wgpu to get WebGPU support and ANGLE to get WebGL support.

Skia is a widely used library (off the top of my head, Chrome, Firefox, and LibreOffice use it) that supports lots of rendering targets, including WebGPU and ANGLE.

I don't mean WebGPU and WebGL as Skia backends. I mean WebGPU and WebGL as APIs that this library could expose to users in addition to the HTML canvas API.

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#53
https://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. Happy to see this project also making Canvas accessible outside the browser!

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#54
post #19

Out 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?

I'd be surprised if you could point out a platform that has better APIs for drawing 2D graphics than Canvas offers. Skia outperforms Direct2D by a little bit and outperforms Cairo by a lot. It is optimized to a high degree and has GPU-accelerated backends.

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#55
post #23
post #19

Out 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?

There isn’t really anything commonly “native” as powerful as skia for 2D drawing and a big part of skia is using the native graphics effectively, this is why it exists in the first place for browser engines. Besides having one target API is a benefit.

> There isn’t really anything commonly “native” as powerful as skia for 2D drawing

Cairo?

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#56

What does "based on Skia" actually mean? Is it a fork of Skia? Does it depend on Skia? Did somebody look at a design diagram of Skia and redo the whole thing from scratch? Did they read about Skia in a blogpost and get the gist of it?

> Does it depend on Skia?

This one

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#57
post #8

Earlier quoted context omitted.

They're not saying Skia itself is browserless; they're saying that "Skia Canvas" is a non-browser-based implementation of what people would normally call the browser Canvas API.

Automattic created node-canvas a long time ago which was based around Cairo.

Automattic acquired LearnBoost who employed TJ Holowaychuk, the original creator of node-canvas (and also Express and tons else). Automattic has not been involved in any way since at least 2017 when I joined node-canvas.

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#59
post #23

Earlier quoted context omitted.

There isn’t really anything commonly “native” as powerful as skia for 2D drawing and a big part of skia is using the native graphics effectively, this is why it exists in the first place for browser engines. Besides having one target API is a benefit.

> There isn’t really anything commonly “native” as powerful as skia for 2D drawing Cairo?

I love Cairo, but it’s just not in the same feature or performance ballpark as skia. There’s a reason even Firefox adopted skia. Skia is like the V8 of 2D drawing libraries, just a ton of continual investment into optimization. I used to work on cairo and pixman, it’s great, very straightforward but not finely tuned for performance on modern hardware.

Re: Skia Canvas: Browserless implementation of the HTML Canvas drawing API for node

#60

How is it different from jimp? https://jimp-dev.github.io/jimp/ Maybe there are some killer features?

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.

Post reply on HN