Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap rendering Context for OffscreenCanvas #4455

Merged
merged 15 commits into from
May 14, 2019
50 changes: 39 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -41359,7 +41359,7 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
data-x="attr-col-span">span</code> attribute, or if trying to parse the attribute's value
resulted in an error or zero, then let <var>span</var> be 1.</p>

<p>If <var>span</var> is greater than 1000, let it be 1000 instead.</p>
<p>If <var>span</var> is greater than 1000, let it be 1000 instead.</p>
annevk marked this conversation as resolved.
Show resolved Hide resolved

</li>

Expand Down Expand Up @@ -41418,7 +41418,7 @@ interface <dfn>HTMLTableCellElement</dfn> : <span>HTMLElement</span> {
data-x="attr-colgroup-span">span</code> attribute, or if trying to parse the attribute's
value resulted in an error or zero, then let <var>span</var> be 1.</p>

<p>If <var>span</var> is greater than 1000, let it be 1000 instead.</p>
<p>If <var>span</var> is greater than 1000, let it be 1000 instead.</p>
annevk marked this conversation as resolved.
Show resolved Hide resolved

</li>

Expand Down Expand Up @@ -65219,10 +65219,10 @@ function AddCloud(data, x, y) { ... }</code></pre>

<h6>The <code>ImageBitmapRenderingContext</code> interface</h6>

<pre><code class="idl" data-x="">[Exposed=Window]
<pre><code class="idl" data-x="">[Exposed=(Window,Worker)]
interface <dfn>ImageBitmapRenderingContext</dfn> {
readonly attribute <span>HTMLCanvasElement</span> <span data-x="dom-ImageBitmapRenderingContext-canvas">canvas</span>;
void <span data-x="dom-ImageBitmapRenderingContext-transferFromImageBitmap">transferFromImageBitmap</span>(ImageBitmap? bitmap);
readonly attribute (<span>HTMLCanvasElement</span> or <span>OffscreenCanvas</span>) <span data-x="dom-ImageBitmapRenderingContext-canvas">canvas</span>;
void <span data-x="dom-ImageBitmapRenderingContext-transferFromImageBitmap">transferFromImageBitmap</span>(<span>ImageBitmap</span>? bitmap);
annevk marked this conversation as resolved.
Show resolved Hide resolved
};

dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {
Expand Down Expand Up @@ -65266,8 +65266,7 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {
</dd>

<dt><var>context</var> . <code
data-x="dom-ImageBitmapRenderingContext-transferFromImageBitmap">transferFromImageBitmap</code>(
null)</dt>
data-x="dom-ImageBitmapRenderingContext-transferFromImageBitmap">transferFromImageBitmap</code>(null)</dt>

<dd>

Expand Down Expand Up @@ -65382,8 +65381,7 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {
<hr>

<p>The <dfn><code>ImageBitmapRenderingContext</code> creation algorithm</dfn>, which is passed a
<var>target</var> (a <code>canvas</code> element) and <var>options</var>, consists of running
these steps:</p>
<var>target</var> and <var>options</var> consists of running these steps:</p>
annevk marked this conversation as resolved.
Show resolved Hide resolved
annevk marked this conversation as resolved.
Show resolved Hide resolved

<ol>
<li><p>Let <var>settings</var> be the result of <span
annevk marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -65458,14 +65456,14 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {

<h5>The <code>OffscreenCanvas</code> interface</h5>

<pre><code class="idl" data-x="">typedef (<span>OffscreenCanvasRenderingContext2D</span> or <span>WebGLRenderingContext</span> or <span>WebGL2RenderingContext</span>) <dfn>OffscreenRenderingContext</dfn>;
<pre><code class="idl" data-x="">typedef (<span>OffscreenCanvasRenderingContext2D</span> or <span>ImageBitmapRenderingContext</span> or <span>WebGLRenderingContext</span> or <span>WebGL2RenderingContext</span>) <dfn>OffscreenRenderingContext</dfn>;

dictionary <dfn>ImageEncodeOptions</dfn> {
DOMString <span data-x="image-encode-options-type">type</span> = "image/png";
unrestricted double <span data-x="image-encode-options-quality">quality</span>;
annevk marked this conversation as resolved.
Show resolved Hide resolved
};

enum <dfn>OffscreenRenderingContextId</dfn> { "<span data-x="offscreen-context-type-2d">2d</span>", "<span data-x="offscreen-context-type-webgl">webgl</span>", "<span data-x="offscreen-context-type-webgl2">webgl2</span>" };
enum <dfn>OffscreenRenderingContextId</dfn> { "<span data-x="offscreen-context-type-2d">2d</span>", "<span data-x="offscreen-context-type-bitmaprenderer">bitmaprenderer</span>, "<span data-x="offscreen-context-type-webgl">webgl</span>", "<span data-x="offscreen-context-type-webgl2">webgl2</span>" };

[<span data-x="dom-OffscreenCanvas">Constructor</span>([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), Exposed=(Window,Worker), <span>Transferable</span>]
interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
Expand Down Expand Up @@ -65516,6 +65514,7 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<p>Returns an object that exposes an API for drawing on the <code>OffscreenCanvas</code>
object. <var>contextId</var> specifies the desired API: "<code
data-x="offscreen-context-type-2d">2d</code>", "<code
data-x="offscreen-context-type-bitmaprenderer">bitmaprenderer</code>", "<code
data-x="offscreen-context-type-webgl">webgl</code>", or "<code
data-x="offscreen-context-type-webgl2">webgl2</code>". <var>options</var> is handled by that
API.</p>
Expand Down Expand Up @@ -65547,6 +65546,7 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
has a <dfn data-x="offscreencanvas-context-mode">context mode</dfn>, which is initially <dfn
data-x="offscreencanvas-context-none">none</dfn> but can be changed to either <dfn
data-x="offscreencanvas-context-2d">2d</dfn>, <dfn
data-x="offscreencanvas-context-bitmaprenderer">bitmaprenderer</dfn>, <dfn
data-x="offscreencanvas-context-webgl">webgl</dfn>, <dfn
data-x="offscreencanvas-context-webgl2">webgl2</dfn>, or <dfn
data-x="offscreencanvas-context-detached">detached</dfn> by algorithms defined in this
Expand Down Expand Up @@ -65625,6 +65625,7 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<td>
<th><span data-x="offscreencanvas-context-none">none</span>
<th><span data-x="offscreencanvas-context-2d">2d</span>
<th><span data-x="offscreencanvas-context-bitmaprenderer">bitmaprenderer</span>
<th><span data-x="offscreencanvas-context-webgl">webgl</span> or <span
data-x="offscreencanvas-context-webgl2">webgl2</span>
<th><span data-x="offscreencanvas-context-detached">detached</span>
Expand All @@ -65645,6 +65646,30 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
first argument.
<td>
Return null.
<td>
Return null.
<td>
Throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.
<tr>
<th>"<dfn><code data-x="offscreen-context-type-bitmaprenderer">bitmaprenderer</code></dfn>"
<td>
Follow the steps to
<span data-x="ImageBitmapRenderingContext creation algorithm">
create an Image Bitmap Rendering Context</span> defined in the
annevk marked this conversation as resolved.
Show resolved Hide resolved
<span>ImageBitmapRenderingContext</span> interface section, passing it this
<code>OffscreenCanvas</code> object and <var>options</var>, to
obtain an <code>ImageBitmapRenderingcontext</code> object; if this does not throw
an exception, then set this <code>OffscreenCanvas</code> object's <span
data-x="offscreencanvas-context-mode">context mode</span> to <span
data-x="offscreencanvas-context-bitmaprenderer">bitmaprenderer</span>, and return the new
<code>ImageBitmapRenderingcontext</code> object.
<td>
Return null.
<td>
Return the same object as was returned the last time the method was invoked with this same
first argument.
<td>
Return null.
<td>
Throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.
<tr>
Expand All @@ -65661,6 +65686,8 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
spec=WEBGL>
<td>
Return null.
<td>
Return null.
<td>
Return the same value as was returned the last time the method was invoked with this same
first argument.
Expand Down Expand Up @@ -122706,6 +122733,7 @@ INSERT INTERFACES HERE
Joshua Bell,
Joshua Randall,
Juan Olvera, <!-- thinkxl on GitHub -->
Juanmi Huertas,
Jukka K. Korpela,
Jules Cl&eacute;ment-Ripoche,
Julian Reschke,
Expand Down