Skip to content

Commit

Permalink
[e] (0) remove some redundant ImageData stuff
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1758 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 13, 2008
1 parent 6ec6303 commit 28db072
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 62 deletions.
46 changes: 15 additions & 31 deletions index
Expand Up @@ -20186,12 +20186,6 @@ XXXDVT (also check for '- -' bits in the part above) -->

<h6 id=pixel><span class=secno>3.11.11.1.11. </span><dfn id=pixel1>Pixel
manipulation</dfn></h6>
<!--
<span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(in float sw, in float sh);
<span>ImageData</span> <span title="dom-context-2d-getImageData">getImageData</span>(in float sx, in float sy, in float sw, in float sh);
void <span title="dom-context-2d-putImageData">putImageData</span>(in <span>ImageData</span> imagedata, in float dx, in float dy);
void <span title="dom-context-2d-putImageData">putImageData</span>(in <span>ImageData</span> imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight);
-->

<p>The <dfn id=createimagedata
title=dom-context-2d-createImageData><code>createImageData(<var
Expand Down Expand Up @@ -20285,11 +20279,7 @@ XXXDVT (also check for '- -' bits in the part above) -->
structures back to the canvas.

<p>If the first argument to the method is null or not an <code><a
href="#imagedata">ImageData</a></code> object that was returned by <code
title=dom-context-2d-createImageData><a
href="#createimagedata">createImageData()</a></code> or <code
title=dom-context-2d-getImageData><a
href="#getimagedata">getImageData()</a></code> then the <code
href="#imagedata">ImageData</a></code> object then the <code
title=dom-context-2d-putImageData><a
href="#putimagedata">putImageData()</a></code> method must raise a
<code>TYPE_MISMATCH_ERR</code> exception.
Expand Down Expand Up @@ -20423,36 +20413,30 @@ context.getImageData(0, 0, w, h);</pre>
<p>The data returned by <code title=dom-context-2d-getImageData><a
href="#getimagedata">getImageData()</a></code> is at the resolution of
the canvas backing store, which is likely to not be one device pixel to
each CSS pixel if the display used is a high resolution display. Thus,
while one could create an <code><a href="#imagedata">ImageData</a></code>
object, one would not necessarily know what resolution the canvas
expected (how many pixels the canvas wants to paint over one coordinate
space unit pixel).</p>
each CSS pixel if the display used is a high resolution display.</p>

<p>In the following example, the script first obtains the size of the
canvas backing store, and then generates a few new <code><a
href="#imagedata">ImageData</a></code> objects which can be used.</p>

<pre>
// canvas is a reference to a &lt;canvas> element
var context = canvas.getContext('2d');
<pre>// canvas is a reference to a &lt;canvas> element
var context = canvas.getContext('2d');

// create a blank slate
var data = context.createImageData(canvas.width, canvas.height);
// create a blank slate
var data = context.createImageData(canvas.width, canvas.height);

// create some plasma
FillPlasma(data, 'green'); // green plasma
// create some plasma
FillPlasma(data, 'green'); // green plasma

// add a cloud to the plasma
AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle
// add a cloud to the plasma
AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle

// paint the plasma+cloud on the canvas
context.putImageData(data, 0, 0);
// paint the plasma+cloud on the canvas
context.putImageData(data, 0, 0);

// support methods
function FillPlasma(data, color) { ... }
function AddCloud(data, x, y) { ... }
</pre>
// support methods
function FillPlasma(data, color) { ... }
function AddCloud(data, x, y) { ... }</pre>
</div>

<div class=example>
Expand Down
48 changes: 17 additions & 31 deletions source
Expand Up @@ -17832,13 +17832,6 @@ XXXDVT (also check for '- -' bits in the part above) -->

<h6><dfn>Pixel manipulation</dfn></h6>

<!--
<span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(in float sw, in float sh);
<span>ImageData</span> <span title="dom-context-2d-getImageData">getImageData</span>(in float sx, in float sy, in float sw, in float sh);
void <span title="dom-context-2d-putImageData">putImageData</span>(in <span>ImageData</span> imagedata, in float dx, in float dy);
void <span title="dom-context-2d-putImageData">putImageData</span>(in <span>ImageData</span> imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight);
-->

<p>The <dfn
title="dom-context-2d-createImageData"><code>createImageData(<var
title="">sw</var>, <var title="">sh</var>)</code></dfn> method must
Expand Down Expand Up @@ -17932,11 +17925,9 @@ XXXDVT (also check for '- -' bits in the part above) -->
<code>ImageData</code> structures back to the canvas.</p>

<p>If the first argument to the method is null or not an
<code>ImageData</code> object that was returned by <code
title="dom-context-2d-createImageData">createImageData()</code> or
<code title="dom-context-2d-getImageData">getImageData()</code> then
the <code title="dom-context-2d-putImageData">putImageData()</code>
method must raise a <code>TYPE_MISMATCH_ERR</code> exception.</p>
<code>ImageData</code> object then the <code
title="dom-context-2d-putImageData">putImageData()</code> method
must raise a <code>TYPE_MISMATCH_ERR</code> exception.</p>

<p>If any of the arguments to the method are infinite or NaN, the
method must raise an <code>INDEX_SIZE_ERR</code> exception.</p>
Expand Down Expand Up @@ -18087,35 +18078,30 @@ context.getImageData(0, 0, w, h);</pre>
title="dom-context-2d-getImageData">getImageData()</code> is at the
resolution of the canvas backing store, which is likely to not be
one device pixel to each CSS pixel if the display used is a high
resolution display. Thus, while one could create an
<code>ImageData</code> object, one would not necessarily know what
resolution the canvas expected (how many pixels the canvas wants to
paint over one coordinate space unit pixel).</p>
resolution display.</p>

<p>In the following example, the script first obtains the size of
the canvas backing store, and then generates a few new
<code>ImageData</code> objects which can be used.</p>

<pre>
// canvas is a reference to a &lt;canvas> element
var context = canvas.getContext('2d');
<pre>// canvas is a reference to a &lt;canvas> element
var context = canvas.getContext('2d');

// create a blank slate
var data = context.createImageData(canvas.width, canvas.height);
// create a blank slate
var data = context.createImageData(canvas.width, canvas.height);

// create some plasma
FillPlasma(data, 'green'); // green plasma
// create some plasma
FillPlasma(data, 'green'); // green plasma

// add a cloud to the plasma
AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle
// add a cloud to the plasma
AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle

// paint the plasma+cloud on the canvas
context.putImageData(data, 0, 0);
// paint the plasma+cloud on the canvas
context.putImageData(data, 0, 0);

// support methods
function FillPlasma(data, color) { ... }
function AddCloud(data, x, y) { ... }
</pre>
// support methods
function FillPlasma(data, color) { ... }
function AddCloud(data, x, y) { ... }</pre>

</div>

Expand Down

0 comments on commit 28db072

Please sign in to comment.