ImageBitmapRenderingContext: transferFromImageBitmap() Methode

Hinweis: Diese Funktion ist in Web Workers verfügbar.

Die ImageBitmapRenderingContext.transferFromImageBitmap() Methode zeigt das angegebene ImageBitmap im Canvas an, das mit diesem Rendering-Kontext verbunden ist. Der Besitz des ImageBitmap wird ebenfalls auf das Canvas übertragen.

Diese Methode hieß zuvor transferImageBitmap(), wurde jedoch in einer Spezifikationsänderung umbenannt. Der alte Name wird als Alias beibehalten, um Code-Brüche zu vermeiden.

Syntax

js
transferFromImageBitmap(bitmap)

Parameter

bitmap

Ein ImageBitmap-Objekt, das übertragen werden soll.

Rückgabewert

Kein (undefined).

Beispiele

HTML

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

JavaScript

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

// Draw a WebGL scene offscreen
const offscreen = new OffscreenCanvas(256, 256);
const gl = offscreen.getContext("webgl");

// Perform some drawing using the gl context

// Transfer the current frame to the visible canvas
const bitmap = offscreen.transferToImageBitmap();
htmlCanvas.transferFromImageBitmap(bitmap);

Spezifikationen

Specification
HTML
# dom-imagebitmaprenderingcontext-transferfromimagebitmap-dev

Browser-Kompatibilität

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.

Siehe auch