ImageBitmapRenderingContext

这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

ImageBitmapRenderingContext 接口是 canvas 的渲染上下文,它只提供了使用给定 ImageBitmap 替换 canvas 的功能。它的上下文 ID (HTMLCanvasElement.getContext() 或 OffscreenCanvas.getContext() 的第一个参数)  是 "bitmaprenderer"。

这个接口可用于 window context 和 worker context.

方法

ImageBitmapRenderingContext.transferFromImageBitmap()

在与此渲染上下文相关的 canvas 中显示给定的 ImageBitmapImageBitmap 的所有权被转移到画布上。 这个函数以前命名为transferImageBitmap(),但在规范中修改了原名字。 为了避免影响之前的代码,旧名称作为别名被保留下来。

规范

Currently drafted as a proposal in the OffscreenCanvas specification.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
ExperimentalNon-standard
Chrome Full support 66Edge ? Firefox Full support 46IE No support NoOpera ? Safari No support NoWebView Android Full support 66Chrome Android Full support 66Edge Mobile ? Firefox Android Full support 46Opera Android ? Safari iOS ? Samsung Internet Android No support No
transferFromImageBitmap
ExperimentalNon-standard
Chrome Full support 66Edge ? Firefox Full support 52
Full support 52
No support 46 — 52
Alternate Name
Alternate Name Uses the non-standard name: transferImageBitmap
IE No support NoOpera ? Safari No support NoWebView Android Full support 66Chrome Android Full support 66Edge Mobile ? Firefox Android Full support 52
Full support 52
No support 46 — 52
Alternate Name
Alternate Name Uses the non-standard name: transferImageBitmap
Opera Android ? Safari iOS ? Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Uses a non-standard name.
Uses a non-standard name.

相关链接

文档标签和贡献者

此页面的贡献者: teoli, jjc
最后编辑者: teoli,