ImageBitmapRenderingContext: transferFromImageBitmap() メソッド

メモ: この機能はウェブワーカー内で利用可能です。

ImageBitmapRenderingContext.transferFromImageBitmap() メソッドは、指定された ImageBitmap をこのレンダリングコンテキストに関連付けられたキャンバスで表示します。ImageBitmap の所有権はキャンバスにも移譲されます。

このメソッドは以前は transferImageBitmap() と名付けられていましたが、仕様変更で名前が変更されました。コードの破損を避けるため、古い名前は別名として残されています。

構文

js
transferFromImageBitmap(bitmap)

引数

bitmap

移譲 ImageBitmap オブジェクトです。

返値

なし (undefined)。

HTML

html
<canvas id="htmlCanvas"></canvas>

JavaScript

js
const htmlCanvas = document
  .getElementById("htmlCanvas")
  .getContext("bitmaprenderer");

// WebGL シーンをオフスクリーンで描画
const offscreen = new OffscreenCanvas(256, 256);
const gl = offscreen.getContext("webgl");

// gl コンテキストを使用して何かを描画

// 現在のフレームを可視キャンバスに移譲
const bitmap = offscreen.transferToImageBitmap();
htmlCanvas.transferFromImageBitmap(bitmap);

仕様書

Specification
HTML
# dom-imagebitmaprenderingcontext-transferfromimagebitmap-dev

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
transferFromImageBitmap

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Uses a non-standard name.
Has more compatibility info.

関連情報