You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-discuss
I have a lot of HTML5 canvas code that I would like to run in a web-worker.
Is it possible to use the CanvasKit drop-in HTML5 Canvas2D replacement in a web-worker?
I guess this uses the software CPU backend for all rendering (which in my case, would be desired).
Thanks,
Peter Verswyvelen
Kevin Lubick
unread,
Jan 21, 2020, 10:58:06 AM1/21/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-discuss
I have not experimented with using CanvasKit in a web-worker, but the CPU version should almost certainly work there, since it draws only into memory. The only way to get output is via a PNG (see .toDataURL), so if that doesn't work for you, file a bug (skbug.com) and we'll see if we can expose something that does.
Peter Verswyvelen
unread,
Jan 21, 2020, 3:11:26 PM1/21/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-discuss
Thanks for the info.
So OffscreenCanvas is not yet supported in a web worker when using CanvasKit?
Initially I mainly want to use the point-in-path operators, so no need for actual rendering.
Best regards, Peter
kjlu...@google.com
unread,
Jan 21, 2020, 3:20:49 PM1/21/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skia-discuss
We have not yet added support for OffscreenCanvas to CanvasKit. However, if you are just doing path-related math, I would recommend looking at PathKit (https://www.npmjs.com/package/pathkit-wasm), which is just the Path related parts of CanvasKit. I see PathKit does not (yet) have the contains method, but I can certainly add that.