canvas context property to PREVENT hardware accelerated rendering?

痴心易碎 提交于 2020-05-24 05:42:23

问题


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.


回答1:


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.


Long Answer:

There's nothing standaradized currently, and the only method available from a 2D context to perform this (demote) is Chrome-Context (chromium) only.

Per MDN:

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.

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.

Conclusion:

The technical answer is maybe. It depends on the Browser you're targeting supporting a non-standardized feature that won't be standardized soon(or possibly ever), and your willingness to not support any other Browser. That being said, the pragmatic answer is no

Hope this helps!



来源:https://stackoverflow.com/questions/55503156/canvas-context-property-to-prevent-hardware-accelerated-rendering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!