Web工作者和画布 [英] Web Workers and Canvas

查看:90
本文介绍了Web工作者和画布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Web工作者是否允许访问一个画布对象?

小小的更新,因为现在的问题已经超过了半个在Chrome / Chromium 6中,您现在可以将画布'ImageData对象发送给Web Worker,让Web Worker对对象进行更改,然后编写它使用 putImageData(..)返回画布。



Google的 Chromabrush 是这样做的,源代码可以在这里找到:



更新

< Opera(10.70)和Firefox(4)的最新开发快照。 0b1)也支持将ImageData对象传递给Web Worker。



2017年更新

来自Github的实际链接(更容易找到 Chromabrush 所需的文件):


Are web workers allowed to access a canvas object?

解决方案

Small update, as the question is now more than half a year old:

In Chrome/Chromium 6 you can now send a canvas' ImageData object to a web worker, let the web worker make changes to the object and then write it back to the canvas using putImageData(..).

Google's Chromabrush does it this way, the source-code can be found here:

Update:

The latest development snapshots of Opera (10.70) and Firefox (4.0b1) also support passing ImageData objects to a web worker.

Update 2017:

Actual links from Github (easier to find needed files from Chromabrush):

这篇关于Web工作者和画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆