Web Workers and Canvas(网络工作者和画布)
问题描述
是否允许网络工作者访问画布对象?
Are web workers allowed to access a canvas object?
推荐答案
小更新,问题到现在半年多了:
Small update, as the question is now more than half a year old:
在 Chrome/Chromium 6 中,您现在可以将画布的 ImageData 对象发送给网络工作者,让网络工作者对对象进行更改,然后使用 putImageData(..) 将其写回画布.
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 的 Chromabrush 就是这样做的,源代码可以在这里找到:
Google's Chromabrush does it this way, the source-code can be found here:
- 主线程李>
- 网络工作者李>
更新:
Opera (10.70) 和 Firefox (4.0b1) 的最新开发快照也支持将 ImageData 对象传递给 web worker.
The latest development snapshots of Opera (10.70) and Firefox (4.0b1) also support passing ImageData objects to a web worker.
2017 年更新:
来自 Github 的实际链接(从 Chromabrush
更容易找到所需的文件):
Actual links from Github (easier to find needed files from Chromabrush
):
- 向工作人员发送 imageData李>
- 接收数据
这篇关于网络工作者和画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:网络工作者和画布


基础教程推荐
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01