OffscreenCanvas.transferToImageBitmap()
Baseline 2023
Newly available
Since March 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
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 Standard # dom-offscreencanvas-transfertoimagebitmap-dev |
浏览器兼容性
BCD tables only load in the browser
浏览相关
- The interface defining this method,
OffscreenCanvas
ImageBitmapRenderingContext.transferImageBitmap()