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李>
- 接收数据
这篇关于网络工作者和画布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:网络工作者和画布


基础教程推荐
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01