[html5] r807 - /

whatwg at whatwg.org whatwg at whatwg.org
Fri May 11 16:07:35 PDT 2007


Author: ianh
Date: 2007-05-11 16:07:32 -0700 (Fri, 11 May 2007)
New Revision: 807

Modified:
   index
   source
Log:
[go] (2) Clarify error handling for getImageData/putImageData

Modified: index
===================================================================
--- index	2007-05-11 22:28:55 UTC (rev 806)
+++ index	2007-05-11 23:07:32 UTC (rev 807)
@@ -16534,8 +16534,22 @@
    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.
+   representing the 8 bit value for that component. At least one pixel must
+   be returned.
 
+  <p class=note>The width and height (<var title="">w</var> and <var
+   title="">h</var>) might be different than the <var title="">sw</var> and
+   <var title="">sh</var> arguments to the function, e.g. if the canvas is
+   backed by a high-resolution bitmap.
+
+  <p>If the <code title=dom-context-2d-getImageData><a
+   href="#getimagedata">getImageData(<var title="">sx</var>, <var
+   title="">sy</var>, <var title="">sw</var>, <var
+   title="">sh</var>)</a></code> method is called with either the <var
+   title="">sw</var> or <var title="">sh</var> arguments set to zero or
+   negative values, the method must raise an <code>INDEX_SIZE_ERR</code>
+   exception.
+
   <p>The <dfn id=putimagedata
    title=dom-context-2d-putImageData><code>putImageData(<var
    title="">image</var>, <var title="">dx</var>, <var
@@ -16545,6 +16559,37 @@
    canvas coordinate space, mapping each pixel represented by the <code><a
    href="#imagedata">ImageData</a></code> structure into one device pixel.
 
+  <p>If any of the following conditions are true, the method must raise a
+   <code>TYPE_MISMATCH_ERR</code> exception:
+
+  <ul>
+   <li>The method's first argument is not an object with <code
+    title=dom-imagedata-width><a href="#width5">width</a></code> and <code
+    title=dom-imagedata-height><a href="#height5">height</a></code>
+    attributes with integer values and a <code title=dom-imagedata-data><a
+    href="#data1">data</a></code> attribute whose value is an integer array.
+
+   <li>The <code><a href="#imagedata">ImageData</a></code> object's <code
+    title=dom-imagedata-width><a href="#width5">width</a></code> is not
+    greater than zero.
+
+   <li>The <code><a href="#imagedata">ImageData</a></code> object's <code
+    title=dom-imagedata-height><a href="#height5">height</a></code> is not
+    greater than zero.
+
+   <li>The <code><a href="#imagedata">ImageData</a></code> object's <code
+    title=dom-imagedata-width><a href="#width5">width</a></code> multiplied
+    by its <code title=dom-imagedata-height><a
+    href="#height5">height</a></code> multiplied by 4 is not equal to the
+    number of entries in the the <code><a
+    href="#imagedata">ImageData</a></code> object's <code
+    title=dom-imagedata-data><a href="#data1">data</a></code> array.
+
+   <li>The <code><a href="#imagedata">ImageData</a></code> object's <code
+    title=dom-imagedata-data><a href="#data1">data</a></code> array contains
+    entries that are not in the range 0 to 255 inclusive.
+  </ul>
+
   <p>The handling of pixel rounding when the specified coordinates do not
    exactly map to the device coordinate space is not defined by this
    specification, except that the following must result in no visible changes

Modified: source
===================================================================
--- source	2007-05-11 22:28:55 UTC (rev 806)
+++ source	2007-05-11 23:07:32 UTC (rev 807)
@@ -14147,8 +14147,21 @@
   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.</p>
+  value for that component. At least one pixel must be returned.</p>
 
+  <p class="note">The width and height (<var title="">w</var> and <var
+  title="">h</var>) might be different than the <var title="">sw</var>
+  and <var title="">sh</var> arguments to the function, e.g. if the
+  canvas is backed by a high-resolution bitmap.</p>
+
+  <p>If the <code
+  title="dom-context-2d-getImageData">getImageData(<var
+  title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>,
+  <var title="">sh</var>)</code> method is called with either the <var
+  title="">sw</var> or <var title="">sh</var> arguments set to zero or
+  negative values, the method must raise an
+  <code>INDEX_SIZE_ERR</code> exception.</p>
+
   <p>The <dfn
   title="dom-context-2d-putImageData"><code>putImageData(<var
   title="">image</var>, <var title="">dx</var>, <var
@@ -14158,6 +14171,37 @@
   coordinate space, mapping each pixel represented by the
   <code>ImageData</code> structure into one device pixel.</p>
 
+  <p>If any of the following conditions are true, the method must
+  raise a <code>TYPE_MISMATCH_ERR</code> exception:</p>
+
+  <ul>
+
+   <li>The method's first argument is not an object with <code
+   title="dom-imagedata-width">width</code> and <code
+   title="dom-imagedata-height">height</code> attributes with integer
+   values and a <code title="dom-imagedata-data">data</code> attribute
+   whose value is an integer array.</li>
+
+   <li>The <code>ImageData</code> object's <code
+   title="dom-imagedata-width">width</code> is not greater than
+   zero.</li>
+
+   <li>The <code>ImageData</code> object's <code
+   title="dom-imagedata-height">height</code> is not greater than
+   zero.</li>
+
+   <li>The <code>ImageData</code> object's <code
+   title="dom-imagedata-width">width</code> multiplied by its <code
+   title="dom-imagedata-height">height</code> multiplied by 4 is not
+   equal to the number of entries in the the <code>ImageData</code>
+   object's <code title="dom-imagedata-data">data</code> array.</li>
+
+   <li>The <code>ImageData</code> object's <code
+   title="dom-imagedata-data">data</code> array contains entries that
+   are not in the range 0 to 255 inclusive.</li>
+
+  </ul>
+
   <p>The handling of pixel rounding when the specified coordinates do
   not exactly map to the device coordinate space is not defined by
   this specification, except that the following must result in no




More information about the Commit-Watchers mailing list