OffscreenCanvas支持2d上下文的状态如何? [英] What's the state of OffscreenCanvas's support for 2d context?

查看:316
本文介绍了OffscreenCanvas支持2d上下文的状态如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Web开发的新手,所以这可能是一个愚蠢的问题.请让我知道它是否已经回答:)

I'm new to web development, so this might be a dumb question. Please let me know if it's already answered:)

根据 MDN Web文档的页面 OffscreenCanvas,当前,该API仅支持WebGL上下文. (也许这只是意味着尚未实现对OffscreenCanvas'2d上下文的辅助支持,但我们仍可以在主线程上使用它吗?)

According to MDN web docs' page for OffscreenCanvas, currently, the API only supports WebGL context only. (Maybe it just means the worker support for OffscreenCanvas' 2d context is not implemented, but we can still use it on the main thread?)

注意:该API当前针对WebGL1和WebGL2上下文实现 只要.有关工作人员对Canvas 2D API的支持,请参见错误801176 .

Note: This API is currently implemented for WebGL1 and WebGL2 contexts only. See bug 801176 for Canvas 2D API support from workers.

但是当我阅读 HTML规范时,对于OffscreenCanvas,支持2d上下文.

But when I read the HTML Specs for OffscreenCanvas, the 2d context is supported.

枚举OffscreenRenderingContextType {"2d","webgl"};

enum OffscreenRenderingContextType { "2d", "webgl" };

我怀疑第二个只是关于OffscreenCanvas应该支持的提议,而第一个是实际支持的提议.我的理解正确吗?如果是这样,我怎么知道特定的浏览器是否支持Chromium之类的OffscreenCanvas的2d上下文?

I suspect the second one is only a proposal for what OffscreenCanvas should support, and the first is what is actually supported. Is my understanding correct? If so, how could I know whether a specific browser supports the 2d context for OffscreenCanvas, like Chromium?

让我更加困惑的是人们将常规canvasoffscreenCanvas称为普通文本,并从中获取2d上下文( example2 ).但是我认为在这种情况下,除了我要研究的OffscreenCanvas之外,他们只是引用没有附加到DOM的常规画布.

What makes me even more confused is people called the regular canvas an offscreenCanvas, and get a 2d context from it (example1, example2). But I think in this case, they are just referring a regular canvas which is not attached to DOM, other than the OffscreenCanvas I like to research on.

推荐答案

我怀疑第二个只是关于OffscreenCanvas应该支持的提议,而第一个是实际支持的提议.我的理解正确吗?

I suspect the second one is only a proposal for what OffscreenCanvas should support, and the first is what is actually supported. Is my understanding correct?

正确的是,WHATWG规范是浏览器应支持的标准. Firefox的#801176错误存在的原因是因为Firefox在该领域没有达到WHATWG规范的要求.

Correct, the WHATWG spec is the standard that browsers should support. The reason Firefox's bug #801176 exists is because Firefox falls short of the requirements of the WHATWG specification in this area.

让我更加困惑的是被称为常规canvasoffscreenCanvas

这些只是称为offscreenCanvas的变量,它们保存普通画布.您可以将变量命名为任何名称;这些作者为当前未在屏幕上呈现的画布选择了描述性名称.

These are simply variables called offscreenCanvas which hold a normal canvas. You can name your variables anything; these authors chose a descriptive name for a canvas that is not currently rendered on the screen.

这篇关于OffscreenCanvas支持2d上下文的状态如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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