<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kenrussell</id>
	<title>WHATWG Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kenrussell"/>
	<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/wiki/Special:Contributions/Kenrussell"/>
	<updated>2026-05-23T06:03:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas.requestAnimationFrame&amp;diff=10287</id>
		<title>OffscreenCanvas.requestAnimationFrame</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas.requestAnimationFrame&amp;diff=10287"/>
		<updated>2019-05-10T17:26:48Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added note indicating this is obsoleted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;This proposal aims to provide a reliable mechanism for driving animations using OffscreenCanvas in a Worker&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== NOTE: OBSOLETED ==&lt;br /&gt;
&lt;br /&gt;
The proposal below was [https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames refined and specified] as requestAnimationFrame on the DedicatedWorkerGlobalScope. This page is maintained only to maintain the history of the discussion.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
An OffscreenCanvas is used in a worker to produce a sequence of frames that constitute an animation. The frames need to be produced at regular intervals that match the frame rate of the display&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
Currently, it is possible to use setTimeout or setInterval in a worker to invoke an animation callback at a regular interval. However, since this mechanism is not driven by the display, the following issues arise:&lt;br /&gt;
* The display device&#039;s refresh rate needs to be guessed.&lt;br /&gt;
* Even if the correct rate is guessed, drift in the timing will cause dropped frames and skipped frames.&lt;br /&gt;
* In GPU-accelerated use cases, it is possible for the rendering script to run at a rate that the GPU cannot keep-up with, which may cause the accumulation of a multi-frame rendering backlog, resulting in high latency and eventually OOM crashes.  A possible solution to this is for the user agent to implement a throttling mechanism, in which case the worker&#039;s event loop may be periodically de-scheduled while the GPU catches up.  Such de-scheduling is bad because it prevents the worker from doing other work.&lt;br /&gt;
&lt;br /&gt;
Another solution is to have a requestAnimationFrame loop in the browsing context&#039;s event loop that posts a message to the worker at each animation iteration.&lt;br /&gt;
* This mechanism may add undue latency to the signal, especially when the browsing context&#039;s event loop is busy, which completely destroys one of the key advantages of using OffscreenCanvas in a worker.&lt;br /&gt;
* The the frame rate in the browsing context&#039;s event loop may be higher than the worker can keep up which which will require a throttling mechanism to be implemented in script&lt;br /&gt;
* As with setTimeout/setInterval, it is possible for the rendering script to run at a rate that the GPU cannot keep-up with.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
New API to drive OffscreenCanvas animations can ensure optimal frame rate, minimize animation jank, prevent overdraw, and minimize display latency.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[https://github.com/w3ctag/spec-reviews/issues/141 W3C TAG review for ImageBitmapRenderingContext]&amp;lt;/cite&amp;gt;&amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;(...) there seems to be a good bit of concern about lack of things like requestAnimationFrame (...)  -- L. David Barron, Mozilla&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Aug/0019.html whatwg mailing list thread &amp;quot;Worker requestAnimationFrame&amp;quot;]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;For OffscreenCanvas we need a way for a Worker to draw once per composited frame. --Robert O&#039;Callahan, Mozilla&lt;br /&gt;
&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== OffscreenCanvas.requestAnimationFrame ===&lt;br /&gt;
&lt;br /&gt;
Works much like window.requestAnimationFrame, except that the scheduling of callbacks is independent of the browsing context event loop, and therefore is not necessarily synchronized with graphics updates from the browsing context.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
The requestAnimationFrame() and cancelAnimationFrame() methods shall be spec&#039;ed almost identically to their Window interface counterparts, except that the callback list would be stored in the OffscreenCanvas object.&lt;br /&gt;
&lt;br /&gt;
The main difference with respect to the Window.requestAnimationFrame processing model is in how the callbacks are scheduled. In a browsing context, the animation callbacks are coordinated with the graphics update in the [https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model event loop processing model]. Such coordination shall not exist in workers.  &lt;br /&gt;
&lt;br /&gt;
For OffscreenCanvases, the user agent will schedule an &amp;quot;animation task&amp;quot; to run all of the OffscreenCanvas&#039;s pending animation callbacks. in a way the respects the following constraints:&lt;br /&gt;
* No overdraw: An animation frame committed from an animation task shall not replace an animation frame from a previous animation task until that previous frame has been rendered to the display device.&lt;br /&gt;
* animation tasks shall be scheduled at the highest possible rate that can be maintained without going into overdraw and without accumulating a backlog of more than one pending frame.&lt;br /&gt;
&lt;br /&gt;
===== Special Cases =====&lt;br /&gt;
&lt;br /&gt;
* When rAF is invoked on an OffscreenCanvas that does not have a placeholder canvas and is not linked to a VRLayer, throw an InvalidStateError. The OffscreenCanvas content must be composited for the rAF processing model to make sense.&lt;br /&gt;
* Attempting to transfer an OffscreenCanvas object with a non-empty animation callback list throws an InvalidStateError.&lt;br /&gt;
* Attempting to construct a VRLayer using an OffscreenCanvas object with a non-empty animation callback list throws an InvalidStateError.&lt;br /&gt;
* When the OffscreenCanvas is associated with a VRLayer, all calls to {request|cancel}AnimationFrame must be forwarded to the VRLayer&#039;s VRDisplay&#039;s {request|cancel}AnimationFrame methods.  This implies that when the OffscreenCanvas simultaneously is visible through a placeholder canvas and a VR device, the animation loop is driven by the VR device.&lt;br /&gt;
* The animations tasks for different OffscreenCanvas objects that live in the same event loop are not necessarily synchronized. &lt;br /&gt;
&lt;br /&gt;
==== Open issues ==== &lt;br /&gt;
Calling commit() on a given OffscreenCanvas multiple times in the same animation frame is problematic.  Possible way of handling the situation:&lt;br /&gt;
* Drop all commits but the last one (or the first one?)&lt;br /&gt;
* Queue multiple frames and wait for all of them to have be displayed before scheduling the next animation task&lt;br /&gt;
* Throw an exception&lt;br /&gt;
&lt;br /&gt;
What to do if commit() is not called from within the animation callback?  This is problematic because &lt;br /&gt;
* Do an implicit commit()&lt;br /&gt;
* Repeat the previous frame&lt;br /&gt;
* Schedule the next animation frame immediately.&lt;br /&gt;
* Prevent this from ever happening: Let OffscreenCanvas object have a needsCommit flag that is initially false. Set needsCommit to true at the beginning of an animation task. Set needsCommit to false when commit is called. When requestAnimationFrame is called, throw an exception if needsCommit is true.&lt;br /&gt;
&lt;br /&gt;
Should it be possible to commit() the contents of other canvases from within a rAF callback? &lt;br /&gt;
&lt;br /&gt;
=== OffscreenCanvas.commit() to return a promise ===&lt;br /&gt;
&lt;br /&gt;
An alternate solution would be to have commit() return a promise that gets resolved when it is time to begin rendering the next frame.  This single API entry-point provides the necessary flexibility to handle continuous animations as well as sporadic updates.&lt;br /&gt;
&lt;br /&gt;
Continuous animation example:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;function animationLoop() {&lt;br /&gt;
  // draw stuff&lt;br /&gt;
  (...)&lt;br /&gt;
  ctx.commit().then(animationLoop);&lt;br /&gt;
  // do post commit work&lt;br /&gt;
  (...)&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another possibility is to use the async/await syntax:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;async function animationLoop() {&lt;br /&gt;
  var promise;&lt;br /&gt;
  do {&lt;br /&gt;
    //draw stuff&lt;br /&gt;
    (...)&lt;br /&gt;
    promise = ctx.commit()&lt;br /&gt;
    // do post commit work&lt;br /&gt;
    (...)&lt;br /&gt;
  } while (await promise);&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To animate multiple canvases in lock-step, one could do this, for eaxample:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;function animationLoop() {&lt;br /&gt;
  // draw stuff&lt;br /&gt;
  (...)&lt;br /&gt;
  Promise.all([ctx1.commit(), ctx2.commit()]).then(animationLoop);&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For occasional update use cases, it is just a matter of ignoring the promise returned by commit() and to drive the animation using another signal, for example a network event.  In the case where multiple calls to commit are made in the same frame interval, the user agent skips frames in order to avoid accumulating a multi-frame backlog, as described in the processing model below.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
An OffscreenCanvas object has a &#039;&#039;pendingFrame&#039;&#039; internal slot that stores a reference to the frame that was captured by the last call to commit(). The reference is held until the frame is actually committed. &#039;pendingFrame&#039; is initially unset.&lt;br /&gt;
&lt;br /&gt;
An OffscreenCanvas object has a &#039;&#039;pendingPromise&#039;&#039; internal slot that stores a reference to the promise that was returned by the last call to commit(). [[pendingPromise]] is initially unset, and its reference is only retained while the promise is in the unresolved state.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;BeginFrame&#039;&#039; signal is a signal that is dispatched by the UserAgent to a specific OffscreenCanvas when it is time to render the next animation frame for the OffscreenCanvas.&lt;br /&gt;
&lt;br /&gt;
When commit() is called:&lt;br /&gt;
# Let &#039;&#039;frame&#039;&#039; be a copy of the current contents of the canvas.&lt;br /&gt;
# If &#039;&#039;pendingPromise&#039;&#039; is set, then run theses substeps:&lt;br /&gt;
## Set &#039;&#039;pendingFrame&#039;&#039; to be a reference to &#039;&#039;frame&#039;&#039;.&lt;br /&gt;
## Return &#039;&#039;pendingPromise&#039;&#039;.&lt;br /&gt;
# Set &#039;&#039;pendingPromise&#039;&#039; to be a newly created unresolved promise object.&lt;br /&gt;
# Run the steps to &#039;&#039;&#039;commit a frame&#039;&#039;&#039;, passing &#039;&#039;frame&#039;&#039; as an argument.&lt;br /&gt;
# Return &#039;&#039;pendingPromise&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When the &#039;&#039;BeginFrame&#039;&#039; signal is to be dispatched to an OffscreenCanvas object, the UserAgent must queue a task on the OffscreenCanvas object&#039;s event loop that runs the following steps: &lt;br /&gt;
# If &#039;&#039;pendingFrame&#039;&#039; is set, then run the following substeps:&lt;br /&gt;
## Run the steps to &#039;&#039;&#039;commit a frame&#039;&#039;&#039;, passing [[pendingFrame]] as an argument.&lt;br /&gt;
## Unset &#039;&#039;pendingFrame&#039;&#039;.&lt;br /&gt;
## Abort these steps.&lt;br /&gt;
# If &#039;&#039;pendingPromise&#039;&#039; is not set then abort these steps.&lt;br /&gt;
# Resolve the promise referenced by &#039;&#039;pendingPromise&#039;&#039;.&lt;br /&gt;
# Unset &#039;&#039;pendingPromise&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
When the user agent is required to run the steps to &#039;&#039;&#039;commit a frame&#039;&#039;&#039;, it must do what is currently spec&#039;ed as the steps for commit().&lt;br /&gt;
&lt;br /&gt;
This processing model takes care the unresolved issues with the OffscreenCanvas.requestAnimationFrame solution because it makes it safe to call commit at any time by providing the following guarantees:&lt;br /&gt;
# In cases of overdraw (commit() called at a rate higher than can be displayed), frames may be dropped to ensure low latency (no more than one frame of backlog).&lt;br /&gt;
# The frame captured by the last call to commit after the end of an animation sequence is never dropped. In other words, when animation stops, it is always the most recent frame that is displayed.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ====&lt;br /&gt;
&lt;br /&gt;
The idea of the commit API was discussed at a meeting of the WebVR working group and has support from multiple browser vendors.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=10068</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=10068"/>
		<updated>2016-05-09T17:54:16Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added link to ImageBitmapRenderingContext in current WHATWG spec.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During initial load and heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 //&lt;br /&gt;
 // Note: this interface has already been incorporated into the current WHATWG&lt;br /&gt;
 // specification at https://html.spec.whatwg.org/multipage/scripting.html#the-imagebitmap-rendering-context .&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferFromImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element. However, if the following situations apply:&lt;br /&gt;
&lt;br /&gt;
* It is a worker thread which is calling commit(), and&lt;br /&gt;
* The worker is calling commit() repeatedly against exactly one rendering context&lt;br /&gt;
&lt;br /&gt;
then it is required that the user agent synchronize the calls to commit() to the vsync interval. Calls to commit() conceptually enqueue frames for display, and after an implementation-defined number of frames have been enqueued, further calls to commit() will block until earlier frames have been presented to the screen. (This requirement allows porting of applications which drive their own main loop rather than using an event-driven loop.)&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
* Some parts of the CanvasRenderingContext2D interface shall not be supported due OffscreenCanvas objects having no relation to the DOM or Frame: HitRegions, scrollPathIntoView, drawFocusIfNeeded.&lt;br /&gt;
* Due to technical challenges, some implementors [https://bugzilla.mozilla.org/show_bug.cgi?id=801176#c29 (Google and Mozilla)] have expressed a desire to ship without initially supporting text rendering in 2D contexts. Open Issue: Should text support be formally excluded from the specification until implementors are prepared to ship it (or until a more feasible API is designed)?&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
==== Example code ====&lt;br /&gt;
&lt;br /&gt;
Jeff Gilbert from Mozilla has crafted some example code utilizing this API:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdashg/snippets/tree/master/webgl-from-worker Rendering WebGL from a worker using the commit() API]&lt;br /&gt;
* [https://github.com/jdashg/snippets/blob/master/webgl-one-to-many/index.html Using one WebGL context to render to many Canvas elements]&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=10060</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=10060"/>
		<updated>2016-04-22T02:09:31Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Renamed ImageBitmapRenderingContext.transferImageBitmap to transferFromImageBitmap per discussion with all Canvas implementers in WebGL working group.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During initial load and heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferFromImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element. However, if the following situations apply:&lt;br /&gt;
&lt;br /&gt;
* It is a worker thread which is calling commit(), and&lt;br /&gt;
* The worker is calling commit() repeatedly against exactly one rendering context&lt;br /&gt;
&lt;br /&gt;
then it is required that the user agent synchronize the calls to commit() to the vsync interval. Calls to commit() conceptually enqueue frames for display, and after an implementation-defined number of frames have been enqueued, further calls to commit() will block until earlier frames have been presented to the screen. (This requirement allows porting of applications which drive their own main loop rather than using an event-driven loop.)&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
* Some parts of the CanvasRenderingContext2D interface shall not be supported due OffscreenCanvas objects having no relation to the DOM or Frame: HitRegions, scrollPathIntoView, drawFocusIfNeeded.&lt;br /&gt;
* Due to technical challenges, some implementors [https://bugzilla.mozilla.org/show_bug.cgi?id=801176#c29 (Google and Mozilla)] have expressed a desire to ship without initially supporting text rendering in 2D contexts. Open Issue: Should text support be formally excluded from the specification until implementors are prepared to ship it (or until a more feasible API is designed)?&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
==== Example code ====&lt;br /&gt;
&lt;br /&gt;
Jeff Gilbert from Mozilla has crafted some example code utilizing this API:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdashg/snippets/tree/master/webgl-from-worker Rendering WebGL from a worker using the commit() API]&lt;br /&gt;
* [https://github.com/jdashg/snippets/blob/master/webgl-one-to-many/index.html Using one WebGL context to render to many Canvas elements]&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9989</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9989"/>
		<updated>2015-09-18T23:32:40Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added comments to asynchronous rendering model about commit() blocking to vsync interval based on feedback from Mozilla.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During initial load and heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element. However, if the following situations apply:&lt;br /&gt;
&lt;br /&gt;
* It is a worker thread which is calling commit(), and&lt;br /&gt;
* The worker is calling commit() repeatedly against exactly one rendering context&lt;br /&gt;
&lt;br /&gt;
then it is required that the user agent synchronize the calls to commit() to the vsync interval. Calls to commit() conceptually enqueue frames for display, and after an implementation-defined number of frames have been enqueued, further calls to commit() will block until earlier frames have been presented to the screen. (This requirement allows porting of applications which drive their own main loop rather than using an event-driven loop.)&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
==== Example code ====&lt;br /&gt;
&lt;br /&gt;
Jeff Gilbert from Mozilla has crafted some example code utilizing this API:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdashg/snippets/tree/master/webgl-from-worker Rendering WebGL from a worker using the commit() API]&lt;br /&gt;
* [https://github.com/jdashg/snippets/blob/master/webgl-one-to-many/index.html Using one WebGL context to render to many Canvas elements]&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9988</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9988"/>
		<updated>2015-09-18T23:22:50Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During initial load and heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
==== Example code ====&lt;br /&gt;
&lt;br /&gt;
Jeff Gilbert from Mozilla has crafted some example code utilizing this API:&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/jdashg/snippets/tree/master/webgl-from-worker Rendering WebGL from a worker using the commit() API]&lt;br /&gt;
* [https://github.com/jdashg/snippets/blob/master/webgl-one-to-many/index.html Using one WebGL context to render to many Canvas elements]&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9937</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9937"/>
		<updated>2015-04-11T00:00:42Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Updated Google Slides use case&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During initial load and heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9936</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9936"/>
		<updated>2015-04-11T00:00:12Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added use case from Google Slides team&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
* (From the Google Slides team): want to layout and render the slide thumbnails from a worker. During heavy collaboration these update frequently, and currently cause slowdowns on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9932</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9932"/>
		<updated>2015-04-08T21:30:26Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added Google Docs use case. Commented that CanvasRenderingContext2D already has a commit method. Added and documented ImageBitmap.close().&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
* (From the Google Docs team): need to be able to layout and render text from a worker using CanvasRenderingContext2D and display those results on the main thread.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 // It&#039;s crucial that there be a way to explicitly dispose of ImageBitmaps&lt;br /&gt;
 // since they refer to potentially large graphics resources. Some uses&lt;br /&gt;
 // of this API proposal will result in repeated allocations of ImageBitmaps,&lt;br /&gt;
 // and garbage collection will not reliably reclaim them quickly enough. &lt;br /&gt;
 // Here we reuse close(), which also exists on another Transferable type,&lt;br /&gt;
 // MessagePort. Potentially, all Transferable types should inherit from a&lt;br /&gt;
 // new interface type &amp;quot;Closeable&amp;quot;. &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   // Dispose of all graphical resources associated with this ImageBitmap.&lt;br /&gt;
   void close(); &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // Note that CanvasRenderingContext2D already has a commit() method&lt;br /&gt;
 // from the CanvasProxy spec which this proposal obsoletes.&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9931</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9931"/>
		<updated>2015-04-08T21:06:46Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added details on objection to using images to display offscreen canvases&amp;#039; rendering results&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but some implementers objected to the mechanism for displaying the rendering results in image elements. The specific objection was that image elements already have complex internal state (for example, the management of the image&#039;s &amp;quot;loaded&amp;quot; state), and this would make it more complex. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9930</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9930"/>
		<updated>2015-04-07T23:25:13Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9929</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9929"/>
		<updated>2015-04-07T23:24:56Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Web IDL */ Use union types for &amp;quot;canvas&amp;quot; back-references in CanvasRenderingContext2D and WebGLRenderingContextBase&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
 partial interface CanvasRenderingContext2D {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // back-reference to the canvas&lt;br /&gt;
   readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;&lt;br /&gt;
 &lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9928</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9928"/>
		<updated>2015-04-07T23:21:33Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Renamed WorkerCanvas to OffscreenCanvas on feedback from annevk@&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] mostly addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings. It also did not precisely address the use case of producing new frames both on the main thread and in workers.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface OffscreenCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // OffscreenCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the OffscreenCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the OffscreenCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 OffscreenCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   OffscreenCanvas transferControlToOffscreen();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with an OffscreenCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToOffscreen method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application. Otherwise,&lt;br /&gt;
   // this call has no effect.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of OffscreenCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The application generates new frames using the RenderingContext obtained from the OffscreenCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the OffscreenCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single OffscreenCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the OffscreenCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToOffscreeen&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that OffscreenCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=WorkerCanvas2&amp;diff=9927</id>
		<title>WorkerCanvas2</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=WorkerCanvas2&amp;diff=9927"/>
		<updated>2015-04-07T23:16:12Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Kenrussell moved page WorkerCanvas2 to OffscreenCanvas: Per feedback from annevk@, renaming the main type in this proposal.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[OffscreenCanvas]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9926</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9926"/>
		<updated>2015-04-07T23:16:12Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Kenrussell moved page WorkerCanvas2 to OffscreenCanvas: Per feedback from annevk@, renaming the main type in this proposal.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with a WorkerCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToWorker method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that WorkerCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9918</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9918"/>
		<updated>2015-04-07T04:02:04Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Implementation */ Rephrased browser vendors&amp;#039; support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with a WorkerCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToWorker method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that WorkerCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed upon the basic form of the API, so it is likely it will be implemented widely and compatibly.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9917</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9917"/>
		<updated>2015-04-07T03:58:47Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Limitations */ Proactively defined commit() method in WebGLRenderingContextBase&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with a WorkerCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToWorker method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that WorkerCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed that the basic form of the API is palatable and implementable.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9916</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9916"/>
		<updated>2015-04-07T03:58:31Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Processing Model */ Proactively added commit() method to WebGLRenderingContext&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with a WorkerCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToWorker method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;getContext&amp;lt;/code&amp;gt; is used to obtain a rendering context for that WorkerCanvas, either on the main thread, or on a worker. The application calls &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; against that rendering context in order to push frames to the original HTMLCanvasElement. In this rendering model, it is not defined when those frames become visible in the original canvas element.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
* The mechanism by which frames are committed in the asynchronous processing model must be defined.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed that the basic form of the API is palatable and implementable.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9915</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9915"/>
		<updated>2015-04-07T03:54:49Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Web IDL */ Proactively added commit method to WebGLRenderingContextBase&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface WebGLRenderingContextBase {&lt;br /&gt;
   // If this context is associated with a WorkerCanvas that was&lt;br /&gt;
   // created by HTMLCanvasElement&#039;s transferControlToWorker method,&lt;br /&gt;
   // causes this context&#039;s current rendering results to be pushed&lt;br /&gt;
   // to that canvas element. This has the same effect as returning&lt;br /&gt;
   // control to the main loop in a single-threaded application.&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. At that point, all rendering operations performed into the WorkerCanvas are displayed in the original HTMLCanvasElement at an indeterminate future time. &#039;&#039;(TODO: define when frames are captured from the WorkerCanvas. Introduce a &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; method onto WebGLRenderingContext as well? Define that frames are captured when control returns to the main loop of the thread driving the WorkerCanvas?)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
* The mechanism by which frames are committed in the asynchronous processing model must be defined.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed that the basic form of the API is palatable and implementable.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9914</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9914"/>
		<updated>2015-04-07T03:50:05Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Web IDL */ updated transferToImageBitmap origin-clean docs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag like other&lt;br /&gt;
   // CanvasImageSource types do, such as HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. At that point, all rendering operations performed into the WorkerCanvas are displayed in the original HTMLCanvasElement at an indeterminate future time. &#039;&#039;(TODO: define when frames are captured from the WorkerCanvas. Introduce a &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; method onto WebGLRenderingContext as well? Define that frames are captured when control returns to the main loop of the thread driving the WorkerCanvas?)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
* The mechanism by which frames are committed in the asynchronous processing model must be defined.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed that the basic form of the API is palatable and implementable.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9913</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9913"/>
		<updated>2015-04-07T03:47:41Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* My Solution */ Renamed to &amp;quot;This Solution&amp;quot; and filled out all sections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag similarly to other&lt;br /&gt;
   // CanvasImageSource types, like HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== This Solution ===&lt;br /&gt;
&lt;br /&gt;
This proposed API can be used in several ways to satisfy the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It supports using a single WebGLRenderingContext or Canvas2DRenderingContext to efficiently render into multiple regions on the web page.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
* It supports asynchronous encoding of WorkerCanvases&#039; rendering results into Blobs which can be consumed by various other web platform APIs.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
This proposal introduces two primary processing models. The first involves &#039;&#039;synchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The application generates new frames using the RenderingContext obtained from the WorkerCanvas. When the application is finished rendering each new frame, it calls transferToImageBitmap to &amp;quot;tear off&amp;quot; the most recently rendered image from the WorkerCanvas -- like a Post-It note. The resulting ImageBitmap can then be used in any API receiving that data type; notably, it can be displayed in a second canvas without introducing a copy. An ImageBitmapRenderingContext is obtained from the second canvas by calling &amp;lt;code&amp;gt;getContext(&#039;bitmaprenderer&#039;)&amp;lt;/code&amp;gt;. Each frame is displayed in the second canvas using the &amp;lt;code&amp;gt;transferImageBitmap&amp;lt;/code&amp;gt; method on this rendering context. Note that the threads producing and consuming the frames may be the same, or they may be different. Note also that a single WorkerCanvas may transfer frames into an arbitrary number of other ImageBitmapRenderingContexts.&lt;br /&gt;
&lt;br /&gt;
The second processing model involves &#039;&#039;asynchronous&#039;&#039; display of new frames produced by the WorkerCanvas. The main thread instantiates an HTMLCanvasElement and calls &amp;lt;code&amp;gt;transferControlToWorker&amp;lt;/code&amp;gt;. At that point, all rendering operations performed into the WorkerCanvas are displayed in the original HTMLCanvasElement at an indeterminate future time. &#039;&#039;(TODO: define when frames are captured from the WorkerCanvas. Introduce a &amp;lt;code&amp;gt;commit&amp;lt;/code&amp;gt; method onto WebGLRenderingContext as well? Define that frames are captured when control returns to the main loop of the thread driving the WorkerCanvas?)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
* A known good way to drive an animation loop from a worker is needed. requestAnimationFrame or a similar API needs to be defined on worker threads.&lt;br /&gt;
&lt;br /&gt;
* The mechanism by which frames are committed in the asynchronous processing model must be defined.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
This proposal has been vetted by developers of Apple&#039;s Safari, Google&#039;s Chrome, Microsoft&#039;s Internet Explorer, and Mozilla&#039;s Firefox browsers. All vendors agreed that the basic form of the API is palatable and implementable.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
Web page authors have demanded increased parallelism support from the web platform for multiple years. If support for multithreaded rendering is added, it is likely it will be rapidly adopted.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9912</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9912"/>
		<updated>2015-04-07T03:22:02Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Web IDL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
 &lt;br /&gt;
   // WorkerCanvas, like HTMLCanvasElement, maintains an origin-clean flag.&lt;br /&gt;
   // ImageBitmaps created by calling this method also have an&lt;br /&gt;
   // origin-clean flag which is set to the value of the WorkerCanvas&#039;s&lt;br /&gt;
   // flag at the time of their construction. Uses of the ImageBitmap&lt;br /&gt;
   // in other APIs, such as CanvasRenderingContext2D or&lt;br /&gt;
   // WebGLRenderingContext, propagate this flag similarly to other&lt;br /&gt;
   // CanvasImageSource types, like HTMLImageElement.&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 &lt;br /&gt;
   // Throws a SecurityError if the WorkerCanvas&#039;s origin-clean flag&lt;br /&gt;
   // is set to false.&lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
&lt;br /&gt;
The API described above can be used in several ways to satisfy all of the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9911</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9911"/>
		<updated>2015-04-07T02:58:09Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* My Solution */ Description of how the abovementioned API satisfies the use cases&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
&lt;br /&gt;
The API described above can be used in several ways to satisfy all of the use cases described above:&lt;br /&gt;
&lt;br /&gt;
* It supports zero-copy transfer of canvases&#039; rendering results between threads, for example from a worker to the main thread. In this model, the main thread controls when to display new frames produced by the worker, so synchronization with other DOM updates is achieved.&lt;br /&gt;
&lt;br /&gt;
* It supports fully asynchronous rendering by a worker into a canvas displayed on the main thread. This satisfies certain Emscripten developers&#039; full-screen use cases.&lt;br /&gt;
&lt;br /&gt;
* It introduces ImageBitmapRenderingContext, a new canvas context type whose sole purpose is to efficiently display ImageBitmaps. This supersedes the [[WorkerCanvas]] proposal&#039;s use of HTMLImageElement for this purpose.&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9910</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9910"/>
		<updated>2015-04-07T02:46:04Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Web IDL */ Updated Web IDL with results of WebGL working group discussion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height),&lt;br /&gt;
  Exposed=(Window,Worker)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   Promise&amp;lt;Blob&amp;gt; toBlob(optional DOMString type, any... arguments);   &lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 // The new ImageBitmapRenderingContext is a canvas rendering context&lt;br /&gt;
 // which only provides the functionality to replace the canvas&#039;s&lt;br /&gt;
 // contents with the given ImageBitmap. Its context id (the first argument&lt;br /&gt;
 // to getContext) is &amp;quot;bitmaprenderer&amp;quot;.&lt;br /&gt;
 [Exposed=(Window,Worker)]&lt;br /&gt;
 interface ImageBitmapRenderingContext {&lt;br /&gt;
   // Displays the given ImageBitmap in the canvas associated with this&lt;br /&gt;
   // rendering context. Ownership of the ImageBitmap is transferred to&lt;br /&gt;
   // the canvas. The caller may not use its reference to the ImageBitmap&lt;br /&gt;
   // after making this call. (This semantic is crucial to enable prompt&lt;br /&gt;
   // reclamation of expensive graphics resources, rather than relying on&lt;br /&gt;
   // garbage collection to do so.)&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap conceptually replaces the canvas&#039;s bitmap, but&lt;br /&gt;
   // it does not change the canvas&#039;s intrinsic width or height.&lt;br /&gt;
   //&lt;br /&gt;
   // The ImageBitmap, when displayed, is clipped to the rectangle&lt;br /&gt;
   // defined by the canvas&#039;s instrinsic width and height. Pixels that&lt;br /&gt;
   // would be covered by the canvas&#039;s bitmap which are not covered by&lt;br /&gt;
   // the supplied ImageBitmap are rendered transparent black. Any CSS&lt;br /&gt;
   // styles affecting the display of the canvas are applied as usual.&lt;br /&gt;
   void transferImageBitmap(ImageBitmap bitmap);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9907</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9907"/>
		<updated>2015-04-03T22:20:58Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Requests for this Feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
* Many others&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9906</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9906"/>
		<updated>2015-04-03T22:20:47Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Requests for this Feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
See the abovementioned use cases:&lt;br /&gt;
&lt;br /&gt;
* Google&#039;s Maps team&lt;br /&gt;
* Emscripten users such as Epic Games and Unity&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9905</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9905"/>
		<updated>2015-04-03T22:18:16Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Benefits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Making canvas rendering contexts available to workers will increase parallelism in web applications, leading to increased performance on multi-core systems.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9904</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9904"/>
		<updated>2015-04-03T22:16:46Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Current Usage and Workarounds */ Linked to Alon Zakai&amp;#039;s blog post on WebGL in workers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
[https://blog.mozilla.org/research/2014/07/22/webgl-in-web-workers-today-and-faster-than-expected/ WebGL in Web Workers] details some work attempted in the Emscripten toolchain to address the lack of WebGL in workers. Due to the high volume of calls and large amount of data that is transferred to the graphics card in a typical high-end WebGL application, this approach is not sustainable. It&#039;s necessary for workers to be able to call the WebGL API directly, and present those results to the screen in a manner that does not introduce any copies of the rendering results.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9903</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9903"/>
		<updated>2015-04-03T22:14:01Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Current Limitations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy] does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&#039;&#039;Some evidence that this feature is desperately needed on the web.  You may provide a separate examples page for listing these.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9902</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9902"/>
		<updated>2015-04-03T22:13:45Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Current Limitations */ Detailed the reasons for creating this proposal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
* (From adopters of the Push API): need to be able to dynamically create images to use as notification icons, such as compositing avatars, or adding an unread count&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
* [https://html.spec.whatwg.org/multipage/scripting.html#proxying-canvases-to-workers CanvasProxy]: does not provide sufficient control to allow synchronization between workers&#039; rendering and DOM updates on the main thread. Keeping this rendering in sync is a requirement from Google&#039;s Maps team.&lt;br /&gt;
* [[CanvasInWorkers]] does not allow a worker to render directly into a canvas on the main thread without running code on the main thread. Allowing completely unsynchronized rendering is a requirement from Mozilla and users of Emscripten such as Epic Games and Unity, in which the desire is to execute all of the game&#039;s rendering on a worker thread.&lt;br /&gt;
* [[WorkerCanvas]] addresses these two use cases, but the specific mechanism for displaying the rendering results (in image elements) was not palatable to some implementers in recent face-to-face meetings.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&#039;&#039;Some evidence that this feature is desperately needed on the web.  You may provide a separate examples page for listing these.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9799</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9799"/>
		<updated>2015-01-27T20:36:35Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&#039;&#039;Explanation of why the current markup is insufficient.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&#039;&#039;Some evidence that this feature is desperately needed on the web.  You may provide a separate examples page for listing these.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Web IDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9798</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9798"/>
		<updated>2015-01-27T20:34:52Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered. This is a follow-on to the [[WorkerCanvas]] proposal and will be merged once agreement is reached.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&#039;&#039;Explanation of why the current markup is insufficient.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&#039;&#039;Some evidence that this feature is desperately needed on the web.  You may provide a separate examples page for listing these.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Category:Proposals&amp;diff=9797</id>
		<title>Category:Proposals</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Category:Proposals&amp;diff=9797"/>
		<updated>2015-01-27T20:33:36Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Deleting temporary WorkerCanvas2 link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a collection of proposals for [[specs]]. Before drafting a proposal, please read [[FAQ#Is_there_a_process_for_adding_new_features_to_a_specification.3F|Is there a process for adding new features to a specification?]].  If you want to add a feature request, start by copying the [[Problem Solving]] template page onto a new page and fill out as much information as you can.&lt;br /&gt;
&lt;br /&gt;
You do not have to provide detailed answers for everything straight away. The most important information to provide at first is the problem description.  Once we have detailed descriptions, use cases and an understanding of the limitations with existing markup, we can then begin to discuss the best way in which to address the problems and work out more of the more technical details.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spec coordination]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9796</id>
		<title>OffscreenCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=OffscreenCanvas&amp;diff=9796"/>
		<updated>2015-01-27T20:32:59Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Creating WorkerCanvas2 page from template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an empty page that describes what should be documented about a problem and the different solutions proposed to address it. Feel free to copy this template to when creating a new page.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Brief description of the problem to solve.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&#039;&#039;Complete description of the use case.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&#039;&#039;Explanation of why the current markup is insufficient.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&#039;&#039;Some evidence that this feature is desperately needed on the web.  You may provide a separate examples page for listing these.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Explanation of how and why new markup would be useful.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://example.com Source]&amp;lt;/cite&amp;gt; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;I would like this feature ...&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== My Solution ===&lt;br /&gt;
:&#039;&#039;Brief description of the solution and of how it address the problem at hand.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
:&#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
:&#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
:&#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
:&#039;&#039;Reasons why page authors would use this solution.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Category:Proposals&amp;diff=9795</id>
		<title>Category:Proposals</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Category:Proposals&amp;diff=9795"/>
		<updated>2015-01-27T20:32:26Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Temporary link to create a new page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a collection of proposals for [[specs]]. Before drafting a proposal, please read [[FAQ#Is_there_a_process_for_adding_new_features_to_a_specification.3F|Is there a process for adding new features to a specification?]].  If you want to add a feature request, start by copying the [[Problem Solving]] template page onto a new page and fill out as much information as you can.&lt;br /&gt;
&lt;br /&gt;
You do not have to provide detailed answers for everything straight away. The most important information to provide at first is the problem description.  Once we have detailed descriptions, use cases and an understanding of the limitations with existing markup, we can then begin to discuss the best way in which to address the problems and work out more of the more technical details.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spec coordination]]&lt;br /&gt;
[[WorkerCanvas2]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=WorkerCanvas&amp;diff=9756</id>
		<title>WorkerCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=WorkerCanvas&amp;diff=9756"/>
		<updated>2014-11-05T18:46:19Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added use case description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Provides more control over how canvases are rendered.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
Feedback from web application authors using canvases have shown the need for the following controls:&lt;br /&gt;
&lt;br /&gt;
* (From ShaderToy, Sketchfab, Verold): need to be able to render to multiple regions on the page efficiently using a single canvas context. 3D model warehouse sites desire to show multiple live interactive models on the page, but creating multiple WebGL contexts per page is too inefficient. A single context should be able to render to multiple regions on the page.&lt;br /&gt;
* (From Google Maps): need to be able to render WebGL from a worker, transfer the rendered image to the main thread without making any copy of it, and composite it with other HTML on the page, guaranteeing that the updates are all seen in the same rendered frame.&lt;br /&gt;
* (From Mozilla and partners using Emscripten and asm.js): need to be able to render WebGL entirely asynchronously from a worker, displaying the results in a canvas owned by the main thread, without any synchronization with the main thread. In this mode, the entire application runs in the worker. The main thread only receives input events and sends them to the worker for processing.&lt;br /&gt;
&lt;br /&gt;
== WebIDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Spec changes ==&lt;br /&gt;
&lt;br /&gt;
Transferring of ImageBitmaps has to be defined. It should neuter the ImageBitmap in the sending thread. Neutering sets the ImageBitmap&#039;s width and height to 0.&lt;br /&gt;
&lt;br /&gt;
HTMLCanvasElement.transferControlToWorker behaves like transferControlToProxy in the current WHATWG spec. WorkerCanvas is Transferable, but transfer fails if transferred other than from the main thread to a worker. All its methods throw if not called on a worker, or if it&#039;s neutered.&lt;br /&gt;
&lt;br /&gt;
ImageBitmap.transferToImage removes the image element&#039;s &amp;quot;src&amp;quot; attribute and makes the image display the contents of the ImageBitmap (until the next transferToImage to that image, or until the image&#039;s &amp;quot;src&amp;quot; attribute is set). The ImageBitmap is neutered.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9755</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9755"/>
		<updated>2014-11-05T18:31:21Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, most user agents decode the image data before calling HTMLImageElement&#039;s onload handler, and it is only legal to construct an ImageBitmap after the HTMLImageElement&#039;s onload handler is called. If the ImageBitmap options would specify different decoding parameters than the browser&#039;s default, the image must be decoded twice, which is inefficient. Further, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the [[https://html.spec.whatwg.org/multipage/webappapis.html#imagebitmapsource ImageBitmapSource union type]], which is the first argument to [[https://html.spec.whatwg.org/multipage/webappapis.html#dom-createimagebitmap createImageBitmap]]. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current mechanisms usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of that specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
* The WebGL 2.0 specification under development will remove the WebGL-specific image decoding options and rely on this mechanism instead.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9754</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9754"/>
		<updated>2014-11-05T18:30:30Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, most user agents decode the image data before calling HTMLImageElement&#039;s onload handler, and it is only legal to construct an ImageBitmap after the HTMLImageElement&#039;s onload handler is called. If the ImageBitmap options would specify different decoding parameters than the browser&#039;s default, the image must be decoded twice, which is inefficient. Further, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the [[https://html.spec.whatwg.org/multipage/webappapis.html#imagebitmapsource ImageBitmapSource union type]], which is the first argument to [[https://html.spec.whatwg.org/multipage/webappapis.html#dom-createimagebitmap createImageBitmap]]. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
* The WebGL 2.0 specification under development will remove the WebGL-specific image decoding options and rely on this mechanism instead.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9753</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9753"/>
		<updated>2014-11-05T18:26:58Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler. (An ImageBitmap can only be constructed from an HTMLImageElement after the image element&#039;s onload handler has fired.) These user agents perform all image decompression before firing the onload handler. The only way that the ImageBitmap options can be taken into account is during the decoding process. Transformations done during decoding, like premultiplying the alpha channel into the color channels, are not reversible.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the [[https://html.spec.whatwg.org/multipage/webappapis.html#imagebitmapsource ImageBitmapSource union type]], which is the first argument to [[https://html.spec.whatwg.org/multipage/webappapis.html#dom-createimagebitmap createImageBitmap]]. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
* The WebGL 2.0 specification under development will remove the WebGL-specific image decoding options and rely on this mechanism instead.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9752</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9752"/>
		<updated>2014-11-05T18:23:43Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Requests for this Feature */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler. (An ImageBitmap can only be constructed from an HTMLImageElement after the image element&#039;s onload handler has fired.) These user agents perform all of the image decompression before firing the onload handler. The only way that the ImageBitmap options can be taken into account is during the decoding process. Transformations done during decoding, like premultiplying the alpha channel into the color channels, are not reversible.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the ImageBitmapSource union type, which is the first argument to createImageBitmap. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
* The WebGL 2.0 specification under development will remove the WebGL-specific image decoding options and rely on this mechanism instead.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9751</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9751"/>
		<updated>2014-11-05T18:22:35Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* DOMString? crossOrigin, default = null &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;The crossOrigin option is a [[https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute CORS settings attribute]]. It is consulted when [[ImageBitmap Constructor taking URL|constructing an ImageBitmap from the URL of an image]]. Because ImageBitmaps can only be constructed from same-origin resources, in order to construct an ImageBitmap from the URL of a cross-origin image resource, the crossOrigin option must be specified, and the server must grant the request. Otherwise the Promise returned from createImageBitmap will be rejected.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9750</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9750"/>
		<updated>2014-11-05T18:22:06Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Strongly desired options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* DOMString? crossOrigin, default = null &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;The crossOrigin option is a [[https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute CORS settings attribute]]. It is consulted when [[ImageBitmap Constructor taking URL|constructing an ImageBitmap from the URL of an image]]. Because ImageBitmaps can only be constructed from same-origin resources, in order to construct an ImageBitmap from a URL of a cross-origin image resources, the crossOrigin option must be specified, and the server must grant the request. Otherwise the Promise returned from createImageBitmap will be rejected.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9749</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9749"/>
		<updated>2014-11-05T18:20:46Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Strongly desired options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* DOMString? crossOrigin, default = null &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;The crossOrigin option is a [[https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute CORS settings attribute]]. It is consulted when [[ImageBitmap Constructor taking URL|constructing an ImageBitmap from the URL of an image]]. Because ImageBitmaps can only be constructed from same-origin resources, the crossOrigin option is required in order to create an ImageBitmap from a URL of a cross-origin image resource, and further, the server must grant the request.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9748</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9748"/>
		<updated>2014-11-05T18:19:17Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Strongly desired options */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* DOMString? crossOrigin, default = null &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;The crossOrigin option is a &amp;lt;a href=&amp;quot;https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute&amp;quot;&amp;gt;CORS settings attribute&amp;lt;/a&amp;gt;. It is consulted when [[ImageBitmap Constructor taking URL|constructing an ImageBitmap from the URL of an image]]. Because ImageBitmaps can only be constructed from same-origin resources, the crossOrigin option is required in order to create an ImageBitmap from a URL of a cross-origin image resource, and further, the server must grant the request.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9747</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9747"/>
		<updated>2014-11-05T18:18:55Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added crossOrigin option, required for creating ImageBitmaps from URLs.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* DOMString? crossOrigin, default = null &amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The crossOrigin option is a &amp;lt;a href=&amp;quot;https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute&amp;quot;&amp;gt;CORS settings attribute&amp;lt;/a&amp;gt;. It is consulted when [[ImageBitmap Constructor taking URL|constructing an ImageBitmap from the URL of an image]]. Because ImageBitmaps can only be constructed from same-origin resources, the crossOrigin option is required in order to create an ImageBitmap from a URL of a cross-origin image resource, and further, the server must grant the request.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9746</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9746"/>
		<updated>2014-11-05T18:11:03Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler. (An ImageBitmap can only be constructed from an HTMLImageElement after the image element&#039;s onload handler has fired.) These user agents perform all of the image decompression before firing the onload handler. The only way that the ImageBitmap options can be taken into account is during the decoding process. Transformations done during decoding, like premultiplying the alpha channel into the color channels, are not reversible.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the ImageBitmapSource union type, which is the first argument to createImageBitmap. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9745</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9745"/>
		<updated>2014-11-05T18:10:50Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the user agent&#039;s premultiplication of the alpha channel into the color channels.&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler. (An ImageBitmap can only be constructed from an HTMLImageElement after the image element&#039;s onload handler has fired.) These user agents perform all of the image decompression before firing the onload handler. The only way that the ImageBitmap options can be taken into account is during the decoding process. Transformations done during decoding, like premultiplying the alpha channel into the color channels, are not reversible.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the ImageBitmapSource union type: the first argument to createImageBitmap. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9744</id>
		<title>ImageBitmap Constructor taking URL</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Constructor_taking_URL&amp;diff=9744"/>
		<updated>2014-11-05T18:03:25Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added proposal for constructing ImageBitmaps from URLs.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;:&#039;&#039;Allows creating an ImageBitmap from the URL of an image.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
&lt;br /&gt;
ImageBitmap provides a useful abstraction for image data that can be drawn to a 2D canvas context or uploaded to a texture in a WebGL canvas context. It attempts to move all of the image decoding and preparation work out of the critical path, so that by the time an ImageBitmap is constructed, the data it contains is in exactly the right format for rendering. [[ImageBitmap Options]] provides control over the image decoding process so that the resulting bitmap is in exactly the desired form. For example, it can be used to disable the premultiplication of the alpha channel into the color channels which most user agents perform upon image decoding (all known ones, at the time of this writing).&lt;br /&gt;
&lt;br /&gt;
Currently an ImageBitmap can only be constructed from a fully-loaded media resource such as an HTMLImageElement. Unfortunately, some user agents discard the compressed image data from HTMLImageElements before firing the onload handler. (An ImageBitmap can only be constructed from an HTMLImageElement after the image element&#039;s onload handler has fired.) These user agents perform all of the image decompression before firing the onload handler. The only way that the ImageBitmap options can be taken into account is during the decoding process. Transformations like premultiplying the alpha channel into the color channels are not reversible.&lt;br /&gt;
&lt;br /&gt;
This proposal adds URL to the ImageBitmapSource union type: the first argument to createImageBitmap. The image is downloaded from that URL, decoded, and processed as part of the construction of the ImageBitmap, taking into account the ImageBitmap options. If any errors occur during the downloading or decoding process, including if the image is not single-origin after honoring the crossOrigin attribute of the ImageBitmap options, the Promise returned from createImageBitmap is rejected. If image downloading and decoding succeeds, then the promise is resolved with the new ImageBitmap as its value.&lt;br /&gt;
&lt;br /&gt;
=== Current Limitations ===&lt;br /&gt;
&lt;br /&gt;
The intent of ImageBitmap is to prepare the image data in the desired form for drawing or texture uploading before resolving the promise returned from createImageBitmap. Unfortunately, most user agents decode the image before calling the onload handler, and it&#039;s only legal to pass an HTMLImageElement to createImageBitmap once the image&#039;s onload handler has been called. This means that at a minimum, in order to respect the [[ImageBitmap Options]] argument to createImageBitmap, two decodes of the image must be done, which is inefficient.&lt;br /&gt;
&lt;br /&gt;
Further, some user agents discard the compressed image data for an HTMLImageElement after decoding it, and before calling the onload handler. Honoring [[ImageBitmap Options]] in these user agents is not possible without rearchitecting their image decoding subsystem.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
Most WebGL applications encode normal maps or other non-image data into images, and upload these images to textures using WebGL-specific options that skip the alpha premultiplication or color correction the user agent may perform. Some WebGL implementers have pointed out that the current WebGL mechanisms are inefficient, and usually result in a synchronous image re-decode. Switching to use ImageBitmap to provide control over these image decoding options will be more efficient, and allow the WebGL mechanisms to be removed in the next version of the WebGL specification.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
Provides the most efficient image decoding path for canvas applications requiring control over image decoding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* Microsoft has requested this feature in order to provide an efficient path for uploading WebGL images to textures.&lt;br /&gt;
* Other WebGL implementers (Apple, Google, Mozilla) support adding this feature and will implement it.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
&lt;br /&gt;
Compared to constructing an ImageBitmap from an HTMLImageElement, this alternative construction path downloads and decodes the image data as part of resolving the promise returned by createImageBitmap.&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
&lt;br /&gt;
Only supports single images. There&#039;s no provision for downloading other types of media from URLs.&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
&lt;br /&gt;
Browser vendors would trigger their usual image downloading and decoding code paths upon creating an ImageBitmap from a URL. Browsers would implement this new API in order to provide more efficient image handling for 2D and WebGL canvas applications.&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
&lt;br /&gt;
WebGL application authors in particular would readily update their code in order to use this new API because it will provide more efficient uploading of images into textures. It&#039;s straightforward to add conditional code which prefers this new, more efficient, mechanism, and which uses the older texture upload paths if it&#039;s not available.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9743</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9743"/>
		<updated>2014-11-05T17:04:00Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: Added link to currently non-existent ImageBitmap Constructor taking URL page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* enum imageOrientation, default = &#039;topLeft&#039; &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;&#039;none&#039;: Do not change orientation.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;flipY&#039;: Flip image vertically, disregarding image orientation meta data (EXIF or other), if any.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;topLeft&#039;:  identify visual orientation from image media meta data and re-order data so top-down, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with bottomLeft orientation. If the image source holds no orientation information, the image orientation is not changed.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&#039;bottomLeft&#039;: identify visual orientation from image media meta data and re-order data so bottom-up, left-to-right processing for display results in correct visual orientation. If the image source is an ImageBitmap, the image data will be flipped vertically if and only if the source was created with topLeft orientation. If the image source holds no orientation information, the image is flipped vertically.&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. blobs and image elements with non-vector images)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, image sources that are premultiplied by alpha will have their color components divided by alpha and image sources that are not premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;If set to true, image sources that are not premultiplied by alpha will have their color components multiplied by alpha and image sources that are premultiplied will be left untouched.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;When premultiplyAlpha is set to false, the division by alpha may result in loss of precision, which must be avoided whenever possible. For example, if the image source is a blob or an image element, the decoded image may already be available in premultipled form. Rather than divide the already decoded data, the user agent must re-decode the image without premultiplying, thus ensuring that the ImageBitmap is delivered with the highest quality data.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Image sources that do not have an alpha channel are not affected by this option.&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;Caution: Canvases are assumed to be premultiplied image sources, which may not always be accurate.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* resizedWidth, resizedHeight: dimension to which the image should be resized. Could also be expressed using scale factors&lt;br /&gt;
* resizeFilter: filtering method used for scaling the image (pixelated, low quality, high quality, etc.)&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
&lt;br /&gt;
Related is the [[ImageBitmap Constructor taking URL]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=WorkerCanvas&amp;diff=9347</id>
		<title>WorkerCanvas</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=WorkerCanvas&amp;diff=9347"/>
		<updated>2013-10-23T23:53:46Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: added Category:Proposals using HotCat&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== WebIDL ==&lt;br /&gt;
&lt;br /&gt;
 [Constructor(unsigned long width, unsigned long height)]&lt;br /&gt;
 interface WorkerCanvas {&lt;br /&gt;
   attribute unsigned long width;&lt;br /&gt;
   attribute unsigned long height;&lt;br /&gt;
   RenderingContext? getContext(DOMString contextId, any... arguments); &lt;br /&gt;
   void toBlob(FileCallback? _callback, optional DOMString type, any... arguments);&lt;br /&gt;
   ImageBitmap transferToImageBitmap();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface RenderingContext {&lt;br /&gt;
   void commit();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 WorkerCanvas implements Transferable;&lt;br /&gt;
 ImageBitmap implements Transferable;&lt;br /&gt;
 &lt;br /&gt;
 partial interface HTMLCanvasElement {&lt;br /&gt;
   WorkerCanvas transferControlToWorker();&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 partial interface ImageBitmap {&lt;br /&gt;
   void transferToImage(HTMLImageElement image);&lt;br /&gt;
 };&lt;br /&gt;
&lt;br /&gt;
== Spec changes ==&lt;br /&gt;
&lt;br /&gt;
Transferring of ImageBitmaps has to be defined. It should neuter the ImageBitmap in the sending thread. Neutering sets the ImageBitmap&#039;s width and height to 0.&lt;br /&gt;
&lt;br /&gt;
HTMLCanvasElement.transferControlToWorker behaves like transferControlToProxy in the current WHATWG spec. WorkerCanvas is Transferable, but transfer fails if transferred other than from the main thread to a worker. All its methods throw if not called on a worker, or if it&#039;s neutered.&lt;br /&gt;
&lt;br /&gt;
ImageBitmap.transferToImage removes the image element&#039;s &amp;quot;src&amp;quot; attribute and makes the image display the contents of the ImageBitmap (until the next transferToImage to that image, or until the image&#039;s &amp;quot;src&amp;quot; attribute is set). The ImageBitmap is neutered.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9251</id>
		<title>ImageBitmap Options</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=ImageBitmap_Options&amp;diff=9251"/>
		<updated>2013-07-17T23:12:26Z</updated>

		<summary type="html">&lt;p&gt;Kenrussell: /* Current Usage and Workarounds */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This page is a Work in Progress&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Problem to be solved&#039;&#039;&#039;: Loading and preparing image resources for rendering to 2D canvas contexts and WebGL contexts is often inefficient using existing APIs.&lt;br /&gt;
&lt;br /&gt;
== Use Case Description ==&lt;br /&gt;
:WebGL applications often use image media for transferring non-image data (illumination maps, vector maps, etc.) For such applications the image data must usually be decoded without colorspace conversions and without alpha premultiplications.&lt;br /&gt;
&lt;br /&gt;
=== Current Usage and Workarounds ===&lt;br /&gt;
&lt;br /&gt;
:Currently, there are several ways to apply arbitrary transformations on the client side, many of which involve intermediate copies of the image data. Some solutions involve DataURLs, temporary canvases, or direct manipulation of image data arrays, which are inefficient. Preparing the resources asynchronously also presents an additional challenge to the web developer.&lt;br /&gt;
&lt;br /&gt;
:WebGL applications can request that colorspace conversions be skipped at texture upload time by specifying pixel storage parameters, but this currently causes a synchronous image decode, because it is not known in advance that the image will need to be decoded in a special way. This latency is a significant problem for applications that upload many images to the GPU, such as Google Maps.&lt;br /&gt;
&lt;br /&gt;
:ImageBitmap offers an opportunity to provide exactly the desired image decoding options when the image is fetched, so that when the ImageBitmap is ready, it is in exactly the desired form for upload to the GPU.&lt;br /&gt;
&lt;br /&gt;
=== Benefits ===&lt;br /&gt;
&lt;br /&gt;
:With the right API support, image resources can be prepared asynchronously and/or in advance to avoid rendering latency issues. Furthermore, the preparation steps could be performed by native code, and in many case they can be integrated directly into the image decoding step without any additional memory consumption and little or no additional computational burden.&lt;br /&gt;
&lt;br /&gt;
=== Requests for this Feature ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-June/039793.html June 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
* &amp;lt;cite&amp;gt;[http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-July/039983.html July 2013 whatwg thread]&amp;lt;/cite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Proposed Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== ImageBitmap Construction Options ===&lt;br /&gt;
&lt;br /&gt;
:Add an optional &#039;&#039;options&#039;&#039; argument to createImageBitmap to specify image treatments to be applied when creating the ImageBitmap object.&lt;br /&gt;
&lt;br /&gt;
==== Strongly desired options ====&lt;br /&gt;
&lt;br /&gt;
* boolean flipY, default = false &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to true, the image is flipped vertically&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean colorspaceConversion, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the ImageBitmap must be created by decoding the source image media without performing any colorspace conversions. This means that the image decoding algorithm must ignore color profile meta-data embedded in the image source as well as the display device color profile.  colorspaceConversion only applies when creating ImageBitmaps from bitmap media data (i.e. Blobs and Image elements)&amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
* boolean premultiplyAlpha, default = true &amp;lt;blockquote&amp;gt;&amp;lt;p&amp;gt;If set to false, the image is decoded without multiplying color components by the alpha component. Only applies when creating ImageBitmaps from bitmap media data. Alpha multiplication is never performed on other types of image sources  &amp;lt;/p&amp;gt;&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Other potentially useful options ====&lt;br /&gt;
&lt;br /&gt;
* frameIndex: for creating an image bitmap from multi-frame image media&lt;br /&gt;
* flipX: like flipY but horizontal&lt;br /&gt;
* colorspace: to decode images to a colorspace other than the device colorspace (sRGB, Adobe RGB, YUV, YCbCr, etc.)&lt;br /&gt;
* custom color tranforms: color matrix, 3D Look up tables, per component look up tables, bias, gain, ... &lt;br /&gt;
&lt;br /&gt;
==== Processing Model ====&lt;br /&gt;
: TBD &#039;&#039;Explanation of the changes introduced by this solution. It explains how the document is processed, and how errors are handled. This should be very clear, including things such as event timing if the solution involves events, how to create graphs representing the data in the case of semantic proposals, etc.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Limitations ==== &lt;br /&gt;
: TBD &#039;&#039;Cases not covered by this solution in relation to the problem description; other problems with this solution, if any.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Implementation ==== &lt;br /&gt;
: TBD &#039;&#039;Description of how and why browser vendors would take advantage of this feature.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Adoption ==== &lt;br /&gt;
* Easier to develop asychronous image resource loading and preparation&lt;br /&gt;
* Better performance that what can be implemented using current APIs&lt;br /&gt;
* Applications can rely on the browser resource management facilities for caching decoded image data with the desired options baked-in and for evicting pre-decoded resources in low memory conditions to avoid out-of-memory crashes.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Kenrussell</name></author>
	</entry>
</feed>