# [html5] r819 - /

whatwg at whatwg.org whatwg at whatwg.org
Tue May 15 18:37:35 PDT 2007

```Author: ianh
Date: 2007-05-15 18:37:32 -0700 (Tue, 15 May 2007)
New Revision: 819

Modified:
index
source
Log:
[agow] (2) Define when infinities are allowed in the canvas APIs

Modified: index
===================================================================
--- index	2007-05-16 01:28:00 UTC (rev 818)
+++ index	2007-05-16 01:37:32 UTC (rev 819)
@@ -15751,6 +15751,20 @@
the identity transform. It may then be adjusted using the transformation
methods.

+  <p>The transformation matrix can become infinite, at which point nothing is
+   drawn anymore.</p>
+  <!--
+   Philip Taylor wrote:
+   > My experience with some 3d canvas code is that infinities come up in
+   > naturally harmless places, e.g. having a function that scales by x then
+   > translates by 1/x and wanting it to work when x=0 (which ought to draw
+   > nothing, since anything it draws is zero pixels wide), and it's a bit
+   > annoying to track down and fix those issues, so I'd probably like it if
+   > they were harmless in canvas methods. Opera appears to silently not draw
+   > anything if the transformation matrix is not finite, but Firefox throws
+   > exceptions when passing in non-finite arguments.
+  -->
+
<p>The transformations must be performed in reverse order. For instance, if
a scale transformation that doubles the width is applied, followed by a
rotation transformation that rotates drawing operations by a quarter turn,
@@ -15762,7 +15776,9 @@
scaling transformation described by the arguments to the transformation
matrix. The <var title="">x</var> argument represents the scale factor in
the horizontal direction and the <var title="">y</var> argument represents
-   the scale factor in the vertical direction. The factors are multiples.
+   the scale factor in the vertical direction. The factors are multiples. If
+   either argument is Infinity the transformation matrix must be marked as
+   infinite instead of the method throwing an exception.

<p>The <dfn id=rotate title=dom-context-2d-rotate><code>rotate(<var
title="">angle</var>)</code></dfn> method must add the rotation
@@ -15777,7 +15793,9 @@
The <var title="">x</var> argument represents the translation distance in
the horizontal direction and the <var title="">y</var> argument represents
the translation distance in the vertical direction. The arguments are in
-   coordinate space units.
+   coordinate space units. If either argument is Infinity the transformation
+   matrix must be marked as infinite instead of the method throwing an
+   exception.

<p>The <dfn id=transform
title=dom-context-2d-transform><code>transform(<var title="">m11</var>,
@@ -15809,6 +15827,9 @@
<td>1
</table>

+  <p>If any of the arguments are Infinity the transformation matrix must be
+   marked as infinite instead of the method throwing an exception.
+
<p>The <dfn id=settransform
title=dom-context-2d-setTransform><code>setTransform(<var
title="">m11</var>, <var title="">m12</var>, <var title="">m21</var>, <var
@@ -15818,7 +15839,8 @@
title=dom-context-2d-transform>transform</a>(<var title="">m11</var>, <var
title="">m12</var>, <var title="">m21</var>, <var title="">m22</var>, <var
title="">dx</var>, <var title="">dy</var>)</code> method with the same
-   arguments.
+   arguments. If any of the arguments are Infinity the transformation matrix
+   must be marked as infinite instead of the method throwing an exception.

<h6 id=compositing><span class=secno>3.14.11.1.3. </span>Compositing</h6>

@@ -16805,6 +16827,9 @@
in the order given (or act as if they do):

<ol>
+   <li>If the current transformation matrix is infinite, then do nothing.
+    Abort these steps.
+
<li>The coordinates are transformed by the current transformation matrix.

<li>The shape or image is rendered, creating image <var title="">A</var>,

Modified: source
===================================================================
--- source	2007-05-16 01:28:00 UTC (rev 818)
+++ source	2007-05-16 01:37:32 UTC (rev 819)
@@ -13322,6 +13322,20 @@
initially be the identity transform. It may then be adjusted using
the transformation methods.</p>

+  <p>The transformation matrix can become infinite, at which point
+  nothing is drawn anymore.</p>
+  <!--
+   Philip Taylor wrote:
+   > My experience with some 3d canvas code is that infinities come up in
+   > naturally harmless places, e.g. having a function that scales by x then
+   > translates by 1/x and wanting it to work when x=0 (which ought to draw
+   > nothing, since anything it draws is zero pixels wide), and it's a bit
+   > annoying to track down and fix those issues, so I'd probably like it if
+   > they were harmless in canvas methods. Opera appears to silently not draw
+   > anything if the transformation matrix is not finite, but Firefox throws
+   > exceptions when passing in non-finite arguments.
+  -->
+
<p>The transformations must be performed in reverse order. For
instance, if a scale transformation that doubles the width is
applied, followed by a rotation transformation that rotates drawing
@@ -13335,7 +13349,9 @@
transformation matrix. The <var title="">x</var> argument represents
the scale factor in the horizontal direction and the <var
title="">y</var> argument represents the scale factor in the
-  vertical direction. The factors are multiples.</p>
+  vertical direction. The factors are multiples. If either argument is
+  Infinity the transformation matrix must be marked as infinite
+  instead of the method throwing an exception.</p>

<p>The <dfn title="dom-context-2d-rotate"><code>rotate(<var
title="">angle</var>)</code></dfn> method must add the rotation
@@ -13349,7 +13365,9 @@
transformation matrix. The <var title="">x</var> argument represents
the translation distance in the horizontal direction and the <var
title="">y</var> argument represents the translation distance in the
-  vertical direction. The arguments are in coordinate space units.</p>
+  vertical direction. The arguments are in coordinate space units. If
+  either argument is Infinity the transformation matrix must be marked
+  as infinite instead of the method throwing an exception.</p>

<p>The <dfn title="dom-context-2d-transform"><code>transform(<var
title="">m11</var>, <var title="">m12</var>, <var
@@ -13375,6 +13393,10 @@
</tr>
</table>

+  <p>If any of the arguments are Infinity the transformation matrix
+  must be marked as infinite instead of the method throwing an
+  exception.</p>
+
<p>The <dfn
title="dom-context-2d-setTransform"><code>setTransform(<var
title="">m11</var>, <var title="">m12</var>, <var
@@ -13384,7 +13406,9 @@
title="dom-context-2d-transform">transform</span>(<var
title="">m11</var>, <var title="">m12</var>, <var
title="">m21</var>, <var title="">m22</var>, <var title="">dx</var>,
-  <var title="">dy</var>)</code> method with the same arguments.</p>
+  <var title="">dy</var>)</code> method with the same arguments. If
+  any of the arguments are Infinity the transformation matrix must be
+  marked as infinite instead of the method throwing an exception.</p>

<h6>Compositing</h6>
@@ -14426,6 +14450,9 @@

<ol>

+   <li>If the current transformation matrix is infinite, then do
+   nothing. Abort these steps.</li>
+
<li>The coordinates are transformed by the current transformation
matrix.</li>

```