Skip to content

Commit

Permalink
[agow] (2) Define when infinities are allowed in the canvas APIs
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@819 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 16, 2007
1 parent cf3deb7 commit 039673b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
31 changes: 28 additions & 3 deletions index
Expand Up @@ -15751,6 +15751,20 @@ interface <dfn id=imagedata>ImageData</dfn> {
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,
Expand All @@ -15762,7 +15776,9 @@ interface <dfn id=imagedata>ImageData</dfn> {
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
Expand All @@ -15777,7 +15793,9 @@ interface <dfn id=imagedata>ImageData</dfn> {
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>,
Expand Down Expand Up @@ -15809,6 +15827,9 @@ interface <dfn id=imagedata>ImageData</dfn> {
<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
Expand All @@ -15818,7 +15839,8 @@ interface <dfn id=imagedata>ImageData</dfn> {
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>

Expand Down Expand Up @@ -16805,6 +16827,9 @@ notes on what would need to be defined for dashed lines:
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>,
Expand Down
33 changes: 30 additions & 3 deletions source
Expand Up @@ -13322,6 +13322,20 @@ interface <dfn>ImageData</dfn> {
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
Expand All @@ -13335,7 +13349,9 @@ interface <dfn>ImageData</dfn> {
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
Expand All @@ -13349,7 +13365,9 @@ interface <dfn>ImageData</dfn> {
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
Expand All @@ -13375,6 +13393,10 @@ interface <dfn>ImageData</dfn> {
</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
Expand All @@ -13384,7 +13406,9 @@ interface <dfn>ImageData</dfn> {
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>
Expand Down Expand Up @@ -14426,6 +14450,9 @@ notes on what would need to be defined for dashed lines:

<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>

Expand Down

0 comments on commit 039673b

Please sign in to comment.