Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Document-free canvas for Web Worker

Is there any implementation of canvas without document.createElement('canvas')?

I want to work with canvas in web worker but i can't pass canvas data to it via worker.postMessage(), because canvas is HTMLElement.

var canvas = document.createElement('canvas'), worker = new Worker('canvas.js');
worker.postMessage(canvas.getData());

Also i don't want to pass canvas's ImageData to web worker because i don't want to implement context2d.drawImage() manually.

like image 441
Dmitrii Sorin Avatar asked Dec 13 '25 01:12

Dmitrii Sorin


1 Answers

Nope. Sorry, ImageData is your only recourse here.

like image 97
Simon Sarris Avatar answered Dec 16 '25 00:12

Simon Sarris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!