画布上下文属性来防止硬件加速渲染? [英] canvas context property to PREVENT hardware accelerated rendering?
问题描述
画布上下文是否有阻止其渲染器使用硬件加速的设置?我想在没有它的情况下进行渲染,但不想要求用户从他们的 chrome 浏览器中禁用它,因为这违反直觉并且不能提供无缝的工作流程体验.
Is there a setting for the canvas context that will prevent its renderer from using hardware acceleration? I want to render without it, but don't want to ask the user to disable it from their chrome browser since that is counter-intuitive and doesn't provide a seamless workflow experience.
推荐答案
Short Answer:
不,但至少开发 Chromium 的人正在考虑它.MDN: CanvasContext2D 在页面中你会发现一个内部称为 demote
的方法.
Short Answer:
No, but it is at least being considered by those developing Chromium. MDN: CanvasContext2D In the page you'll find an internal method called demote
.
目前没有任何标准化,从 2D 上下文中可以执行此操作的唯一方法 (demote
) 仅是 Chrome-Context (chromium).
There's nothing standaradized currently, and the only method available from a 2D context to perform this (demote
) is Chrome-Context (chromium) only.
根据 MDN:
CanvasRenderingContext2D.demote()这会导致当前使用硬件加速后端的上下文回退到软件后端.应保留所有状态.
CanvasRenderingContext2D.demote() This causes a context that is currently using a hardware-accelerated backend to fallback to a software one. All state should be preserved.
很明显他们已经考虑过了,但我不认为它会很快被采用,因为它可能不是讨论/痛点的优先主题.此外,不幸的是,由于它是 Chrome 特定的实现,并且我们正在处理改变浏览器本身行为的方式,因此没有办法通过 polyfilling 或 shimming 将此功能修补到其他浏览器中.
It's apparent they've considered it, but I wouldn't expect it to be adopted any time soon as it is probably not a prioritized topic of discussion/pain-point. Furthermore, unfortunately since it's a Chrome specific implementation and we're dealing with altering the way the Browser itself behaves, there isn't a way to patch this functionality into other Browsers through polyfilling or shimming.
技术答案是也许.这取决于您的目标浏览器支持不会很快(或可能永远不会)标准化的非标准化功能,以及您不支持任何其他浏览器的意愿.话虽如此,务实的答案是否
希望这有帮助!
这篇关于画布上下文属性来防止硬件加速渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!