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

View in English Always switch to English

OffscreenCanvas.transferToImageBitmap()

Baseline Widely available

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

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

OffscreenCanvas.transferToImageBitmap() 方法使用offscreenCanvas最近渲染得到的图片创建一个ImageBitmap 对象。

语法

ImageBitmap OffscreenCanvas.transferToImageBitmap() 

返回值

一个ImageBitmap对象。

例子

js
var offscreen = new OffscreenCanvas(256, 256); var gl = offscreen.getContext("webgl"); //一些绘制要使用 gl 前后文 offscreen.transferToImageBitmap(); // ImageBitmap { width: 256, height: 256 } 

Specifications

Specification
HTML
# dom-offscreencanvas-transfertoimagebitmap-dev

浏览器兼容性

浏览相关