[html5] r1740 - /

whatwg at whatwg.org whatwg at whatwg.org
Wed Jun 11 02:49:43 PDT 2008


Author: ianh
Date: 2008-06-11 02:49:43 -0700 (Wed, 11 Jun 2008)
New Revision: 1740

Modified:
   index
   source
Log:
[agir] (2) Specify ImageData.data as a CanvasPixelArray.

Modified: index
===================================================================
--- index	2008-06-10 22:28:40 UTC (rev 1739)
+++ index	2008-06-11 09:49:43 UTC (rev 1740)
@@ -25,7 +25,7 @@
 
    <h1 id=html-5>HTML 5</h1>
 
-   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 10 June
+   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 11 June
     2008</h2>
 
    <p>You can take part in this work. <a
@@ -18249,7 +18249,13 @@
 interface <dfn id=imagedata>ImageData</dfn> {
   readonly attribute long int <a href="#width3" title=dom-imagedata-width>width</a>;
   readonly attribute long int <a href="#height2" title=dom-imagedata-height>height</a>;
-  readonly attribute int[] <a href="#data1" title=dom-imagedata-data>data</a>;
+  readonly attribute <a href="#canvaspixelarray">CanvasPixelArray</a> <a href="#data1" title=dom-imagedata-data>data</a>;
+};
+
+interface <dfn id=canvaspixelarray>CanvasPixelArray</dfn> {
+  readonly attribute unsigned long <a href="#length5" title=dom-canvaspixelarray-length>length</a>;
+  [IndexGetter] <span>float</span> <span title=dom-XXX5>XXX5</span>(in unsigned long index); <!-- XXX DOMB -->
+  [IndexSetter] void <span title=dom-XXX6>XXX6</span>(in unsigned long index, in float value); <!-- XXX DOMB -->
 };</pre>
 
   <p>The <dfn id=canvas0
@@ -20041,30 +20047,45 @@
    <var title="">w</var>, the number of physical device pixels per row in the
    image data, their <dfn id=height2
    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 the <dfn
-   id=data1 title=dom-imagedata-data><code>data</code></dfn> attribute is
-   initialized to an array of <var title="">h</var>×<var
-   title="">w</var>×4 integers. The pixels must be represented in this
-   array in left-to-right order, row by row, starting at the top left, with
-   each pixel's red, green, blue, and alpha components being given in that
-   order. Each component of each device pixel represented in this array must
+   <var title="">h</var>, the number of rows in the image data, and their
+   <dfn id=data1 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>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.
-   At least one pixel must be returned.
+   The components must be assigned consecutive indices starting with 0 for
+   the top left pixel's red component.
 
-  <p>The values of the <code title=dom-imagedata-data><a
-   href="#data1">data</a></code> array may be changed (the length of the
-   array, and the other attributes in <code><a
-   href="#imagedata">ImageData</a></code> objects, are all read-only). On
-   setting, JS <code>undefined</code> values must be converted to zero. Other
-   values must first be converted to numbers using JavaScript's ToNumber
-   algorithm, and if the result is a NaN value, a
-   <code>TYPE_MISMATCH_ERR</code> exception must be raised. If the result is
-   less than 0, it must be clamped to zero. If the result is more than 255,
-   it must be clamped to 255. If the number is not an integer, it must be
-   rounded to the nearest integer using the IEEE 754r <i>roundTiesToEven</i>
-   rounding mode. <a href="#refsECMA262">[ECMA262]</a> <a
-   href="#refsIEEE754r">[IEEE754R]</a>
+  <p>The <code><a href="#canvaspixelarray">CanvasPixelArray</a></code> object
+   thus represents <var title="">h</var>×<var title="">w</var>×4
+   integers. The <dfn id=length5
+   title=dom-canvaspixelarray-length><code>length</code></dfn> attribute of a
+   <code><a href="#canvaspixelarray">CanvasPixelArray</a></code> object must
+   return this number.
 
+  <p>The <dfn id=xxx5index title=dom-canvaspixelarray-XXX5><code>XXX5(<var
+   title="">index</var>)</code></dfn> method must return the value of the
+   <var title="">index</var>th component in the array.
+
+  <p>The <dfn id=xxx6index title=dom-canvaspixelarray-XXX6><code>XXX6(<var
+   title="">index</var>, <var title="">value</var>)</code></dfn> method must
+   set the value of the <var title="">index</var>th component in the array to
+   <var title="">value</var>. JS <code>undefined</code> values must be
+   converted to zero. Other values must first be converted to numbers using
+   JavaScript's ToNumber algorithm, and if the result is a NaN value, then
+   the value be must converted to zero. If the result is less than 0, it must
+   be clamped to zero. If the result is more than 255, it must be clamped to
+   255. If the number is not an integer, it must be rounded to the nearest
+   integer using the IEEE 754r <i>roundTiesToEven</i> rounding mode. <a
+   href="#refsECMA262">[ECMA262]</a> <a href="#refsIEEE754r">[IEEE754R]</a>
+
   <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
@@ -25849,7 +25870,7 @@
    depth, which would then require the selection to be infinite if every row,
    including every hidden row, was selected.
 
-  <p>The <dfn id=length5
+  <p>The <dfn id=length6
    title=dom-DataGridSelection-length><code>length</code></dfn> attribute
    must return the number of rows currently present in the selection. The
    <dfn id=itemindex3 title=dom-DataGridSelection-item><code>item(<var
@@ -25880,7 +25901,7 @@
    method must mark all the rows in the data grid as selected. After a call
    to <code title=dom-DataGridSelection-selectAll><a
    href="#selectall">selectAll()</a></code>, the <code
-   title=dom-DataGridSelection-length><a href="#length5">length</a></code>
+   title=dom-DataGridSelection-length><a href="#length6">length</a></code>
    attribute will return the number of rows in the data grid, not counting
    children of closed rows.
 
@@ -25894,7 +25915,7 @@
    mark all the rows in the data grid to be marked as not selected. After a
    call to <code title=dom-DataGridSelection-clear><a
    href="#clear">clear()</a></code>, the <code
-   title=dom-DataGridSelection-length><a href="#length5">length</a></code>
+   title=dom-DataGridSelection-length><a href="#length6">length</a></code>
    attribute will return zero.
 
   <p>If the <code><a href="#datagrid0">datagrid</a></code> element has a <dfn
@@ -28421,7 +28442,7 @@
 
   // other browsing contexts
   readonly attribute <a href="#window">Window</a> <a href="#frames" title=dom-frames>frames</a>;
-  readonly attribute unsigned long <a href="#length6" title=dom-length>length</a>;
+  readonly attribute unsigned long <a href="#length7" title=dom-length>length</a>;
   [IndexGetter] <a href="#window">Window</a> <a href="#xxx4index" title=dom-XXX4>XXX4</a>(in unsigned long index); <!-- XXX DOMB -->
   readonly attribute <a href="#window">Window</a> <a href="#opener0" title=dom-opener>opener</a>;
   <a href="#window">Window</a> <a href="#open2" title=dom-open>open</a>();
@@ -28667,7 +28688,7 @@
   <h4 id=accessing><span class=secno>4.2.4 </span>Accessing other browsing
    contexts</h4>
 
-  <p>The <dfn id=length6 title=dom-length><code>length</code></dfn> DOM
+  <p>The <dfn id=length7 title=dom-length><code>length</code></dfn> DOM
    attribute on the <code><a href="#window">Window</a></code> interface must
    return the number of <a href="#child" title="child browsing context">child
    browsing contexts</a> of the <a href="#active" title="active
@@ -31615,7 +31636,7 @@
   void <a href="#swapcache" title=dom-appcache-swapCache>swapCache</a>();
 
   // dynamic entries
-  readonly attribute unsigned long <a href="#length7" title=dom-appcache-length>length</a>;
+  readonly attribute unsigned long <a href="#length8" title=dom-appcache-length>length</a>;
   DOMString <a href="#itemindex4" title=dom-appcache-item>item</a>(in unsigned long index);
   void <a href="#adduri" title=dom-appcache-add>add</a>(in DOMString uri);
   void <a href="#remove1" title=dom-appcache-remove>remove</a>(in DOMString uri);
@@ -31717,7 +31738,7 @@
      title=concept-appcache-manifest>manifest</a>.
   </dl>
 
-  <p>The <dfn id=length7 title=dom-appcache-length><code>length</code></dfn>
+  <p>The <dfn id=length8 title=dom-appcache-length><code>length</code></dfn>
    attribute must return the number of <a href="#dynamic3"
    title=concept-appcache-dynamic>dynamic entries</a> in the <a
    href="#application0">application cache</a> with which the <code><a
@@ -31731,7 +31752,7 @@
    title=dom-appcache-add><a href="#adduri">add()</a></code> method, with the
    oldest entry being the zeroth entry, and the most recently added entry
    having the index <span><code title=dom-appcache-length><a
-   href="#length7">length</a></code>-1</span>.
+   href="#length8">length</a></code>-1</span>.
 
   <p>The <dfn id=itemindex4 title=dom-appcache-item><code>item(<var
    title="">index</var>)</code></dfn> method must return the absolute URI of
@@ -31742,7 +31763,7 @@
    the object is not associated with any application cache, or if the <var
    title="">index</var> argument is lower than zero or greater than
    <span><code title=dom-appcache-length><a
-   href="#length7">length</a></code>-1</span>, the method must instead raise
+   href="#length8">length</a></code>-1</span>, the method must instead raise
    an <code>INDEX_SIZE_ERR</code> exception.
 
   <p>The <dfn id=adduri title=dom-appcache-add><code>add(<var
@@ -32091,7 +32112,7 @@
    href="#history2">History</a></code> interface</h4>
 
   <pre class=idl>interface <dfn id=history2>History</dfn> {
-  readonly attribute long <a href="#length8" title=dom-history-length>length</a>;
+  readonly attribute long <a href="#length9" title=dom-history-length>length</a>;
   void <a href="#godelta" title=dom-history-go>go</a>(in long delta);
   void <a href="#go" title=dom-history-go-0>go</a>();
   void <a href="#back" title=dom-history-back>back</a>();
@@ -32101,7 +32122,7 @@
   void <a href="#clearstate" title=dom-history-clearState>clearState</a>();
 };</pre>
 
-  <p>The <dfn id=length8 title=dom-history-length><code>length</code></dfn>
+  <p>The <dfn id=length9 title=dom-history-length><code>length</code></dfn>
    attribute of the <code><a href="#history2">History</a></code> interface
    must return the number of entries in this <a href="#session">session
    history</a>.
@@ -32114,7 +32135,7 @@
 
   <p>If the index of the <a href="#current1">current entry</a> plus <var
    title="">delta</var> is less than zero or greater than or equal to the <a
-   href="#length8" title=dom-history-length>number of items in the session
+   href="#length9" title=dom-history-length>number of items in the session
    history</a>, then the user agent must do nothing.
 
   <p>If the <var title="">delta</var> is zero, then the user agent must act
@@ -34130,7 +34151,7 @@
   something? -->
 
   <pre class=idl>interface <dfn id=storage0>Storage</dfn> {
-  readonly attribute unsigned long <a href="#length9" title=dom-Storage-length>length</a>;
+  readonly attribute unsigned long <a href="#length10" title=dom-Storage-length>length</a>;
   [IndexGetter] DOMString <a href="#keyn" title=dom-Storage-key>key</a>(in unsigned long index);
   [NameGetter] DOMString <a href="#getitem" title=dom-Storage-getItem>getItem</a>(in DOMString key);
   [NameSetter] void <a href="#setitem" title=dom-Storage-setItem>setItem</a>(in DOMString key, in DOMString data);
@@ -34163,7 +34184,7 @@
    href="#storage0">Storage</a></code> interface can all be associated with
    the same list of key/value pairs simultaneously.
 
-  <p>The <dfn id=length9 title=dom-Storage-length><code>length</code></dfn>
+  <p>The <dfn id=length10 title=dom-Storage-length><code>length</code></dfn>
    attribute must return the number of key/value pairs currently present in
    the list associated with the object.
 
@@ -34449,7 +34470,7 @@
    detect any concurrent script execution.
 
   <p>This is required to guarantee that the <code title=dom-Storage-length><a
-   href="#length9">length</a></code> attribute of a <code><a
+   href="#length10">length</a></code> attribute of a <code><a
    href="#storage0">Storage</a></code> object never changes while a script is
    executing, other than in a way that is predictable by the script itself.
 
@@ -34768,17 +34789,17 @@
    href="#sqlresultsetrowlist">SQLResultSetRowList</a></code> representing
    the rows returned, in the order returned by the database. If no rows were
    returned, then the object will be empty (its <code
-   title=dom-SQLResultSetRowList-length><a href="#length10">length</a></code>
+   title=dom-SQLResultSetRowList-length><a href="#length11">length</a></code>
    will be zero).
 
   <pre
    class=idl>interface <dfn id=sqlresultsetrowlist>SQLResultSetRowList</dfn> {
-  readonly attribute unsigned long <a href="#length10" title=dom-SQLResultSetRowList-length>length</a>;
+  readonly attribute unsigned long <a href="#length11" title=dom-SQLResultSetRowList-length>length</a>;
   [IndexGetter] <span>DOMObject</span> <a href="#itemindex5" title=dom-SQLResultSetRowList-item>item</a>(in unsigned long index);
 };</pre>
 
   <p><code><a href="#sqlresultsetrowlist">SQLResultSetRowList</a></code>
-   objects have a <dfn id=length10
+   objects have a <dfn id=length11
    title=dom-SQLResultSetRowList-length><code>length</code></dfn> attribute
    that must return the number of rows it represents (the number of rows
    returned by the database).
@@ -39037,7 +39058,7 @@
   void <a href="#clearundo" title=dom-UndoManager-clearUndo>clearUndo</a>();
   void <a href="#clearredo" title=dom-UndoManager-clearRedo>clearRedo</a>();
   [IndexGetter] DOMObject <a href="#itemn" title=dom-UndoManager-item>item</a>(in unsigned long index);
-  readonly attribute unsigned long <a href="#length11" title=dom-UndoManager-length>length</a>;
+  readonly attribute unsigned long <a href="#length12" title=dom-UndoManager-length>length</a>;
   readonly attribute unsigned long <a href="#position0" title=dom-UndoManager-position>position</a>;
 };</pre>
 
@@ -39055,7 +39076,7 @@
    entries are absent from the <a href="#undo-transaction">undo transaction
    history</a>.
 
-  <p>The <dfn id=length11
+  <p>The <dfn id=length12
    title=dom-UndoManager-length><code>length</code></dfn> attribute must
    return the number of <a href="#undo-object">undo object</a> entries in the
    <a href="#undo-transaction">undo transaction history</a>.
@@ -39079,7 +39100,7 @@
    nearest to the <a href="#current4">undo position</a>, on the "redo" side.
    If there are no <a href="#undo-object">undo object</a> entries on the
    "redo" side, then the attribute must return the same as the <code
-   title=dom-UndoManager-length><a href="#length11">length</a></code>
+   title=dom-UndoManager-length><a href="#length12">length</a></code>
    attribute. If there are no <a href="#undo-object">undo object</a> entries
    on the "undo" side of the <a href="#current4">undo position</a>, the <code
    title=dom-UndoManager-position><a href="#position0">position</a></code>
@@ -39126,7 +39147,7 @@
    href="#undo-object">undo object</a> entry with the specified <var
    title="">index</var>. If the index is less than zero or greater than or
    equal to <code title=dom-UndoManager-length><a
-   href="#length11">length</a></code> then the method must raise an
+   href="#length12">length</a></code> then the method must raise an
    <code>INDEX_SIZE_ERR</code> exception. <a href="#dom-changes">DOM
    changes</a> entries are unaffected by this method.
 

Modified: source
===================================================================
--- source	2008-06-10 22:28:40 UTC (rev 1739)
+++ source	2008-06-11 09:49:43 UTC (rev 1740)
@@ -15872,7 +15872,13 @@
 interface <dfn>ImageData</dfn> {
   readonly attribute long int <span title="dom-imagedata-width">width</span>;
   readonly attribute long int <span title="dom-imagedata-height">height</span>;
-  readonly attribute int[] <span title="dom-imagedata-data">data</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>;
+  [IndexGetter] <span>float</span> <span title="dom-XXX5">XXX5</span>(in unsigned long index); <!-- XXX DOMB -->
+  [IndexSetter] void <span title="dom-XXX6">XXX6</span>(in unsigned long index, in float value); <!-- XXX DOMB -->
 };</pre>
 
   <p>The <dfn title="dom-context-2d-canvas"><code>canvas</code></dfn>
@@ -17708,27 +17714,42 @@
   pixels per row in the image data, their <dfn
   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 the <dfn title="dom-imagedata-data"><code>data</code></dfn>
-  attribute is initialized to an array of <var
+  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>×<var title="">w</var>×4 integers. The
-  pixels must be represented in this array in left-to-right order, row
-  by row, starting at the top left, with each pixel's red, green,
-  blue, and alpha components being given in that order. 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. At least
-  one pixel must be returned.</p>
+  <dfn title="dom-canvaspixelarray-length"><code>length</code></dfn>
+  attribute of a <code>CanvasPixelArray</code> object must return this
+  number.</p>
 
-  <p>The values of the <code title="dom-imagedata-data">data</code>
-  array may be changed (the length of the array, and the other
-  attributes in <code>ImageData</code> objects, are all read-only). On
-  setting, JS <code>undefined</code> values must be converted to zero.
-  Other values must first be converted to numbers using JavaScript's
-  ToNumber algorithm, and if the result is a NaN value, a
-  <code>TYPE_MISMATCH_ERR</code> exception must be raised. If the
-  result is less than 0, it must be clamped to zero. If the result is
-  more than 255, it must be clamped to 255. If the number is not an
-  integer, it must be rounded to the nearest integer using the IEEE
-  754r <i>roundTiesToEven</i> rounding mode.  <a
+  <p>The <dfn title="dom-canvaspixelarray-XXX5"><code>XXX5(<var
+  title="">index</var>)</code></dfn> method must return the value of
+  the <var title="">index</var>th component in the array.</p>
+
+  <p>The <dfn title="dom-canvaspixelarray-XXX6"><code>XXX6(<var
+  title="">index</var>, <var title="">value</var>)</code></dfn> method
+  must set the value of the <var title="">index</var>th component in
+  the array to <var title="">value</var>. JS <code>undefined</code>
+  values must be converted to zero.  Other values must first be
+  converted to numbers using JavaScript's ToNumber algorithm, and if
+  the result is a NaN value, then the value be must converted to
+  zero. If the result is less than 0, it must be clamped to zero. If
+  the result is more than 255, it must be clamped to 255. If the
+  number is not an integer, it must be rounded to the nearest integer
+  using the IEEE 754r <i>roundTiesToEven</i> rounding mode.  <a
   href="#refsECMA262">[ECMA262]</a> <a
   href="#refsIEEE754r">[IEEE754R]</a></p>
 




More information about the Commit-Watchers mailing list