Web/API/ImageBitmapRenderingContext/transferFromImageBitmap
This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
The ImageBitmapRenderingContext.transferFromImageBitmap()
method displays the given ImageBitmap
in the canvas associated with this rendering context. The ownership of the ImageBitmap
is transferred to the canvas as well.
This method was previously named transferImageBitmap()
, but was renamed in a spec change. The old name is being kept as an alias to avoid code breakage.
Syntax
void ImageBitmapRenderingContext.transferFromImageBitmap(bitmap)
Parameters
bitmap
- An
ImageBitmap
object to transfer.
Examples
HTML
<canvas id="htmlCanvas"></canvas>
JavaScript
var htmlCanvas = document.getElementById("htmlCanvas").getContext("bitmaprenderer");
// Draw a WebGL scene offscreen
var offscreen = new OffscreenCanvas(256, 256);
var gl = offscreen.getContext("webgl");
// ... some drawing using the gl context ...
// Transfer the current frame to the visible canvas
var bitmap = offscreen.transferToImageBitmap();
htmlCanvas.transferFromImageBitmap(bitmap);
Specifications
Specification | Status | Comment |
HTML Living StandardThe definition of 'transferFromImageBitmap()' in that specification. | Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 66 |
Edge
Full support ≤79 |
Firefox Full support 52 Full support 52 No support 46 — 52 Alternate Name' Uses the non-standard name: |
IE
No support No |
Opera
Full support Yes |
Safari
No support No |
WebView Android
Full support 66 |
Chrome Android
Full support 66 |
Firefox Android Full support 52 Full support 52 No support 46 — 52 Alternate Name' Uses the non-standard name: |
Opera Android
Full support Yes |
Safari iOS
? |
Samsung Internet Android
Full support 9.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- Uses a non-standard name.'
- Uses a non-standard name.
See also
- The interface defining this method,
ImageBitmapRenderingContext
OffscreenCanvas
OffscreenCanvas.transferToImageBitmap()
ImageBitmapRenderingContext.transferFromImageBitmap() by Mozilla Contributors is licensed under CC-BY-SA 2.5.