此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

ImageBitmapRenderingContext

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2020年1月⁩.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

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.

浏览器兼容性

相关链接