canvas上下文属性可以防止硬件加速渲染? [英] canvas context property to PREVENT hardware accelerated rendering?

查看:286
本文介绍了canvas上下文属性可以防止硬件加速渲染?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在画布上下文的设置,该设置将阻止其渲染器使用硬件加速?
我想在没有它的情况下进行渲染,但是不想让用户从其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.

推荐答案

简短答案:



否,但至少那些正在开发铬的人正在考虑。 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(铬)。

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特定的实现,并且我们正在改变浏览器本身的行为方式,因此无法通过填充或填充将功能添加到其他浏览器中。

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.

技术答案是 也许 。这取决于您要定位的浏览器是否支持即将(或可能永远不会)标准化的非标准化功能,以及您是否愿意不支持任何其他浏览器。话虽如此,务实的答案是

希望这会有所帮助!

这篇关于canvas上下文属性可以防止硬件加速渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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