此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
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> |
浏览器兼容性
Enable JavaScript to view this browser compatibility table.
浏览相关
- The interface defining this method,
OffscreenCanvas ImageBitmapRenderingContext.transferImageBitmap()