Skip to content
Permalink
Browse files

[giow] (2) Kill CanvasPixelArray in favour of the Typed Array stuff.

git-svn-id: http://svn.whatwg.org/webapps@6559 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Sep 21, 2011
1 parent 7737a89 commit e6b6055e20b9b5b8f1c7df730403efb414280abb
Showing with 54 additions and 161 deletions.
  1. +18 −51 complete.html
  2. +18 −51 index
  3. +18 −59 source

</dd>

<dt>If <var title="">input</var> is a <code><a href=#imagedata>ImageData</a></code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#imagedata>ImageData</a></code> object
with the same <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and
<code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> as <var title="">input</var>, and with a newly constructed
<code><a href=#canvaspixelarray>CanvasPixelArray</a></code> for its <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute, with the same
<code title=dom-canvaspixelarray-length><a href=#dom-canvaspixelarray-length>length</a></code> and pixel
values as the <var title="">input</var>'s.</dd>

<dt>If <var title="">input</var> is a <code><a href=#file>File</a></code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#file>File</a></code> object corresponding to the same underlying data.</dd>
interface <dfn id=imagedata>ImageData</dfn> {
readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
readonly attribute <a href=#canvaspixelarray>CanvasPixelArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};

interface <dfn id=canvaspixelarray>CanvasPixelArray</dfn> {
readonly attribute unsigned long <a href=#dom-canvaspixelarray-length title=dom-canvaspixelarray-length>length</a>;
<a href=#dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>getter</a> octet (unsigned long index);
<a href=#dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>setter</a> void (unsigned long index, [Clamp] octet value);
readonly attribute <span>Uint8ClampedArray</span> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};</pre>

<!-- ARC-ORDER note (see above):
pixels per row in the image data, their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn> attribute is
set to <var title="">h</var>, the number of rows in the image data,
and their <dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn>
attribute is initialized to a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object
holding the image data. At least one pixel's worth of image data
must be returned.</p>

<p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object provides ordered,
indexed access to the color components of each pixel of the image
data. The data must be represented in left-to-right order, row by
row top to bottom, starting with the top left, with each pixel's
red, green, blue, and alpha components being given in that order for
each pixel. Each component of each device pixel represented in this
array must be in the range 0..255, representing the 8 bit value for
that component. The components must be assigned consecutive indices
starting with 0 for the top left pixel's red component.</p>

<p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object thus represents <var title="">h</var>&times;<var title="">w</var>&times;4 integers. The
<dfn id=dom-canvaspixelarray-length title=dom-canvaspixelarray-length><code>length</code></dfn>
attribute of a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object must return this
number.</p>

<p>The object's <a href=#supported-property-indices>supported property indices</a> are the
numbers in the range 0 .. <span title=""><var title="">h</var>&times;<var title="">w</var>&times;4-1</span>.</p>

<p>To <dfn id=dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>determine the value of
an indexed property</dfn> <var title="">index</var>, the user agent
must return the value of the <var title="">index</var>th component
in the array.</p>

<p>To <dfn id=dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>set the value of an
existing indexed property</dfn> <var title="">index</var> to value
<var title="">value</var>, the value of the <var title="">index</var>th component in the array must be set to <var title="">value</var>.</p>

<p class=note>The width and height (<var title="">w</var> and <var title="">h</var>) might be different from the <var title="">sw</var>
and <var title="">sh</var> arguments to the above methods, e.g. if
the canvas is backed by a high-resolution bitmap, or if the <var title="">sw</var> and <var title="">sh</var> arguments are
negative.</p>
attribute is initialized to a <code>Uint8ClampedArray</code> object.
The <code>Uint8ClampedArray</code> object must use a <a href=#canvas-pixel-arraybuffer>Canvas
Pixel <code>ArrayBuffer</code></a> for its storage, and must have
a zero start offset and a length equal to the length of its storage,
in bytes. The <a href=#canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></a>
must contain the image data. At least one pixel's worth of image
data must be returned. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

<p>A <dfn id=canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></dfn> is an
<code><a href=#arraybuffer>ArrayBuffer</a></code> that whose data is represented in
left-to-right order, row by row top to bottom, starting with the top
left, with each pixel's red, green, blue, and alpha components being
given in that order for each pixel. Each component of each device
pixel represented in this array must be in the range 0..255,
representing the 8 bit value for that component. The components must
be assigned consecutive indices starting with 0 for the top left
pixel's red component. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

<p>The <dfn id=dom-context-2d-putimagedata title=dom-context-2d-putImageData><code>putImageData(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var>)</code></dfn> method writes data from
<code><a href=#imagedata>ImageData</a></code> structures back to the canvas.</p>
69 index

</dd>

<dt>If <var title="">input</var> is a <code><a href=#imagedata>ImageData</a></code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#imagedata>ImageData</a></code> object
with the same <code title=dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and
<code title=dom-imagedata-height><a href=#dom-imagedata-height>height</a></code> as <var title="">input</var>, and with a newly constructed
<code><a href=#canvaspixelarray>CanvasPixelArray</a></code> for its <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute, with the same
<code title=dom-canvaspixelarray-length><a href=#dom-canvaspixelarray-length>length</a></code> and pixel
values as the <var title="">input</var>'s.</dd>

<dt>If <var title="">input</var> is a <code><a href=#file>File</a></code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code><a href=#file>File</a></code> object corresponding to the same underlying data.</dd>
interface <dfn id=imagedata>ImageData</dfn> {
readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
readonly attribute <a href=#canvaspixelarray>CanvasPixelArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};

interface <dfn id=canvaspixelarray>CanvasPixelArray</dfn> {
readonly attribute unsigned long <a href=#dom-canvaspixelarray-length title=dom-canvaspixelarray-length>length</a>;
<a href=#dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>getter</a> octet (unsigned long index);
<a href=#dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>setter</a> void (unsigned long index, [Clamp] octet value);
readonly attribute <span>Uint8ClampedArray</span> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
};</pre>

<!-- ARC-ORDER note (see above):
pixels per row in the image data, their <dfn id=dom-imagedata-height title=dom-imagedata-height><code>height</code></dfn> attribute is
set to <var title="">h</var>, the number of rows in the image data,
and their <dfn id=dom-imagedata-data title=dom-imagedata-data><code>data</code></dfn>
attribute is initialized to a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object
holding the image data. At least one pixel's worth of image data
must be returned.</p>

<p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object provides ordered,
indexed access to the color components of each pixel of the image
data. The data must be represented in left-to-right order, row by
row top to bottom, starting with the top left, with each pixel's
red, green, blue, and alpha components being given in that order for
each pixel. Each component of each device pixel represented in this
array must be in the range 0..255, representing the 8 bit value for
that component. The components must be assigned consecutive indices
starting with 0 for the top left pixel's red component.</p>

<p>The <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object thus represents <var title="">h</var>&times;<var title="">w</var>&times;4 integers. The
<dfn id=dom-canvaspixelarray-length title=dom-canvaspixelarray-length><code>length</code></dfn>
attribute of a <code><a href=#canvaspixelarray>CanvasPixelArray</a></code> object must return this
number.</p>

<p>The object's <a href=#supported-property-indices>supported property indices</a> are the
numbers in the range 0 .. <span title=""><var title="">h</var>&times;<var title="">w</var>&times;4-1</span>.</p>

<p>To <dfn id=dom-canvaspixelarray-get title=dom-CanvasPixelArray-get>determine the value of
an indexed property</dfn> <var title="">index</var>, the user agent
must return the value of the <var title="">index</var>th component
in the array.</p>

<p>To <dfn id=dom-canvaspixelarray-set title=dom-CanvasPixelArray-set>set the value of an
existing indexed property</dfn> <var title="">index</var> to value
<var title="">value</var>, the value of the <var title="">index</var>th component in the array must be set to <var title="">value</var>.</p>

<p class=note>The width and height (<var title="">w</var> and <var title="">h</var>) might be different from the <var title="">sw</var>
and <var title="">sh</var> arguments to the above methods, e.g. if
the canvas is backed by a high-resolution bitmap, or if the <var title="">sw</var> and <var title="">sh</var> arguments are
negative.</p>
attribute is initialized to a <code>Uint8ClampedArray</code> object.
The <code>Uint8ClampedArray</code> object must use a <a href=#canvas-pixel-arraybuffer>Canvas
Pixel <code>ArrayBuffer</code></a> for its storage, and must have
a zero start offset and a length equal to the length of its storage,
in bytes. The <a href=#canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></a>
must contain the image data. At least one pixel's worth of image
data must be returned. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

<p>A <dfn id=canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></dfn> is an
<code><a href=#arraybuffer>ArrayBuffer</a></code> that whose data is represented in
left-to-right order, row by row top to bottom, starting with the top
left, with each pixel's red, green, blue, and alpha components being
given in that order for each pixel. Each component of each device
pixel represented in this array must be in the range 0..255,
representing the 8 bit value for that component. The components must
be assigned consecutive indices starting with 0 for the top left
pixel's red component. <a href=#refsTYPEDARRAY>[TYPEDARRAY]</a></p>

<p>The <dfn id=dom-context-2d-putimagedata title=dom-context-2d-putImageData><code>putImageData(<var title="">imagedata</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dirtyX</var>, <var title="">dirtyY</var>, <var title="">dirtyWidth</var>, <var title="">dirtyHeight</var>)</code></dfn> method writes data from
<code><a href=#imagedata>ImageData</a></code> structures back to the canvas.</p>
77 source
@@ -8943,17 +8943,6 @@ interface <dfn>Transferable</dfn> { };</pre>

</dd>

<dt>If <var title="">input</var> is a <code>ImageData</code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code>ImageData</code> object
with the same <code title="dom-imagedata-width">width</code> and
<code title="dom-imagedata-height">height</code> as <var
title="">input</var>, and with a newly constructed
<code>CanvasPixelArray</code> for its <code
title="dom-imagedata-data">data</code> attribute, with the same
<code title="dom-canvaspixelarray-length">length</code> and pixel
values as the <var title="">input</var>'s.</p></dd>

<dt>If <var title="">input</var> is a <code>File</code> object</dt>

<dd><p>Let <var title="">output</var> be a newly constructed <code>File</code> object corresponding to the same underlying data.</p></dd>
interface <dfn>ImageData</dfn> {
readonly attribute unsigned long <span title="dom-imagedata-width">width</span>;
readonly attribute unsigned long <span title="dom-imagedata-height">height</span>;
readonly attribute <span>CanvasPixelArray</span> <span title="dom-imagedata-data">data</span>;
};

interface <dfn>CanvasPixelArray</dfn> {
readonly attribute unsigned long <span title="dom-canvaspixelarray-length">length</span>;
<span title="dom-CanvasPixelArray-get">getter</span> octet (unsigned long index);
<span title="dom-CanvasPixelArray-set">setter</span> void (unsigned long index, [Clamp] octet value);
readonly attribute <span>Uint8ClampedArray</span> <span title="dom-imagedata-data">data</span>;
};</pre>

<!-- ARC-ORDER note (see above):
title="dom-imagedata-height"><code>height</code></dfn> attribute is
set to <var title="">h</var>, the number of rows in the image data,
and their <dfn title="dom-imagedata-data"><code>data</code></dfn>
attribute is initialized to a <code>CanvasPixelArray</code> object
holding the image data. At least one pixel's worth of image data
must be returned.</p>

<p>The <code>CanvasPixelArray</code> object provides ordered,
indexed access to the color components of each pixel of the image
data. The data must be represented in left-to-right order, row by
row top to bottom, starting with the top left, with each pixel's
red, green, blue, and alpha components being given in that order for
each pixel. Each component of each device pixel represented in this
array must be in the range 0..255, representing the 8 bit value for
that component. The components must be assigned consecutive indices
starting with 0 for the top left pixel's red component.</p>

<p>The <code>CanvasPixelArray</code> object thus represents <var
title="">h</var>&times;<var title="">w</var>&times;4 integers. The
<dfn title="dom-canvaspixelarray-length"><code>length</code></dfn>
attribute of a <code>CanvasPixelArray</code> object must return this
number.</p>

<p>The object's <span>supported property indices</span> are the
numbers in the range 0 .. <span title=""><var
title="">h</var>&times;<var title="">w</var>&times;4-1</span>.</p>

<p>To <dfn title="dom-CanvasPixelArray-get">determine the value of
an indexed property</dfn> <var title="">index</var>, the user agent
must return the value of the <var title="">index</var>th component
in the array.</p>

<p>To <dfn title="dom-CanvasPixelArray-set">set the value of an
existing indexed property</dfn> <var title="">index</var> to value
<var title="">value</var>, the value of the <var
title="">index</var>th component in the array must be set to <var
title="">value</var>.</p>

<p class="note">The width and height (<var title="">w</var> and <var
title="">h</var>) might be different from the <var title="">sw</var>
and <var title="">sh</var> arguments to the above methods, e.g. if
the canvas is backed by a high-resolution bitmap, or if the <var
title="">sw</var> and <var title="">sh</var> arguments are
negative.</p>
attribute is initialized to a <code>Uint8ClampedArray</code> object.
The <code>Uint8ClampedArray</code> object must use a <span>Canvas
Pixel <code>ArrayBuffer</code></span> for its storage, and must have
a zero start offset and a length equal to the length of its storage,
in bytes. The <span>Canvas Pixel <code>ArrayBuffer</code></span>
must contain the image data. At least one pixel's worth of image
data must be returned. <a href="#refsTYPEDARRAY">[TYPEDARRAY]</a></p>

<p>A <dfn>Canvas Pixel <code>ArrayBuffer</code></dfn> is an
<code>ArrayBuffer</code> that whose data is represented in
left-to-right order, row by row top to bottom, starting with the top
left, with each pixel's red, green, blue, and alpha components being
given in that order for each pixel. Each component of each device
pixel represented in this array must be in the range 0..255,
representing the 8 bit value for that component. The components must
be assigned consecutive indices starting with 0 for the top left
pixel's red component. <a href="#refsTYPEDARRAY">[TYPEDARRAY]</a></p>

<p>The <dfn
title="dom-context-2d-putImageData"><code>putImageData(<var

0 comments on commit e6b6055

Please sign in to comment.
You can’t perform that action at this time.