Skip to content

Commit

Permalink
[gow] (2) Change how lineTo(), arcTo(), quadraticCurveTo(), and bezie…
Browse files Browse the repository at this point in the history
…rCurveTo() behave when there's not been a moveTo() call before them.

git-svn-id: http://svn.whatwg.org/webapps@3476 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 27, 2009
1 parent 805bf73 commit 7acbbda
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 45 deletions.
56 changes: 32 additions & 24 deletions index
Expand Up @@ -24312,48 +24312,58 @@ notes on what would need to be defined for dashed lines:
create a new subpath with the specified point as its first (and
only) point.</p>

<p>When the user agent is to <dfn id=ensure-there-is-a-subpath>ensure there is a subpath</dfn>
for a coordinate (<var title="">x</var>, <var title="">y</var>), the
user agent must check to see if the context has any subpaths, and if
it does not, then the user agent must create a new subpath with the
point (<var title="">x</var>, <var title="">y</var>) as its first
(and only) point, as if the <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> method had been
called.</p>


<p>The <dfn id=dom-context-2d-closepath title=dom-context-2d-closePath><code>closePath()</code></dfn>
method must do nothing if the context has no subpaths. Otherwise, it
must mark the last subpath as closed, create a new subpath whose
first point is the same as the previous subpath's first point, and
finally add this new subpath to the path. (If the last subpath had
more than one point in its list of points, then this is equivalent
to adding a straight line connecting the last point back to the
first point, thus "closing" the shape, and then repeating the last
<code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> call.)</p>
finally add this new subpath to the path.</p>

<p class=note>If the last subpath had more than one point in its
list of points, then this is equivalent to adding a straight line
connecting the last point back to the first point, thus "closing"
the shape, and then repeating the last (possibly implied) <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo()</a></code> call.</p>


<p>New points and the lines connecting them are added to subpaths
using the methods described below. In all cases, the methods only
modify the last subpath in the context's paths.</p>


<p>The <dfn id=dom-context-2d-lineto title=dom-context-2d-lineTo><code>lineTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must do
nothing if the context has no subpaths. Otherwise, it must connect
the last point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a straight line, and
must then add the given point (<var title="">x</var>, <var title="">y</var>) to the subpath.</p>
<p>The <dfn id=dom-context-2d-lineto title=dom-context-2d-lineTo><code>lineTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
<a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x</var>, <var title="">y</var>)</span> if the context has
no subpaths. Otherwise, it must connect the last point in the
subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a straight line, and must then add the given
point (<var title="">x</var>, <var title="">y</var>) to the
subpath.</p>


<p>The <dfn id=dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo><code>quadraticCurveTo(<var title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>,
<var title="">y</var>)</code></dfn> method must do nothing if the
context has no subpaths. Otherwise it must connect the last point in
the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a quadratic B&eacute;zier curve with control
<var title="">y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath>ensure there
is a subpath</a> for <span title="">(<var title="">cpx</var>,
<var title="">cpy</var>)</span>, and then must connect the last
point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a quadratic B&eacute;zier curve with control
point (<var title="">cpx</var>, <var title="">cpy</var>), and must
then add the given point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>


<p>The <dfn id=dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo><code>bezierCurveTo(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method must do
nothing if the context has no subpaths. Otherwise, it must connect
the last point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
<p>The <dfn id=dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo><code>bezierCurveTo(<var title="">cp1x</var>, <var title="">cp1y</var>, <var title="">cp2x</var>, <var title="">cp2y</var>, <var title="">x</var>, <var title="">y</var>)</code></dfn> method must
<a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">cp1x</var>, <var title="">cp1y</var>)</span>, and then must
connect the last point in the subpath to the given point (<var title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
curve with control points (<var title="">cp1x</var>, <var title="">cp1y</var>) and (<var title="">cp2x</var>, <var title="">cp2y</var>). Then, it must add the point (<var title="">x</var>, <var title="">y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>


<p>The <dfn id=dom-context-2d-arcto title=dom-context-2d-arcTo><code>arcTo(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
<hr><p>The <dfn id=dom-context-2d-arcto title=dom-context-2d-arcTo><code>arcTo(<var title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
<var title="">y2</var>, <var title="">radius</var>)</code></dfn>
method must do nothing if the context has no subpaths. If the
context <em>does</em> have a subpath, then the behavior depends on
the arguments and the last point in the subpath.</p>
method must first <a href=#ensure-there-is-a-subpath>ensure there is a subpath</a> for <span title="">(<var title="">x1</var>, <var title="">y1</var>)</span>. Then, the behavior depends on the
arguments and the last point in the subpath, as described below.</p>

<p>Negative values for <var title="">radius</var> must cause the
implementation to raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
Expand Down Expand Up @@ -24389,8 +24399,7 @@ notes on what would need to be defined for dashed lines:
the start tangent point to the end tangent point by <var title="">The Arc</var>, adding the end tangent point to the
subpath.</p>


<p>The <dfn id=dom-context-2d-arc title=dom-context-2d-arc><code>arc(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
<hr><p>The <dfn id=dom-context-2d-arc title=dom-context-2d-arc><code>arc(<var title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
<var title="">startAngle</var>, <var title="">endAngle</var>, <var title="">anticlockwise</var>)</code></dfn> method draws an arc. If
the context has any subpaths, then the method must add a straight
line from the last point in the subpath to the start point of the
Expand Down Expand Up @@ -24432,8 +24441,7 @@ notes on what would need to be defined for dashed lines:
implementation to raise an <code><a href=#index_size_err>INDEX_SIZE_ERR</a></code>
exception.</p>


<p>The <dfn id=dom-context-2d-rect title=dom-context-2d-rect><code>rect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must create a new subpath
<hr><p>The <dfn id=dom-context-2d-rect title=dom-context-2d-rect><code>rect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must create a new subpath
containing just the four points (<var title="">x</var>, <var title="">y</var>), (<var title="">x</var>+<var title="">w</var>,
<var title="">y</var>), (<var title="">x</var>+<var title="">w</var>, <var title="">y</var>+<var title="">h</var>),
(<var title="">x</var>, <var title="">y</var>+<var title="">h</var>), with those four points connected by straight
Expand Down
62 changes: 41 additions & 21 deletions source
Expand Up @@ -26511,17 +26511,28 @@ notes on what would need to be defined for dashed lines:
create a new subpath with the specified point as its first (and
only) point.</p>

<p>When the user agent is to <dfn>ensure there is a subpath</dfn>
for a coordinate (<var title="">x</var>, <var title="">y</var>), the
user agent must check to see if the context has any subpaths, and if
it does not, then the user agent must create a new subpath with the
point (<var title="">x</var>, <var title="">y</var>) as its first
(and only) point, as if the <code
title="dom-context-2d-moveTo">moveTo()</code> method had been
called.</p>


<p>The <dfn
title="dom-context-2d-closePath"><code>closePath()</code></dfn>
method must do nothing if the context has no subpaths. Otherwise, it
must mark the last subpath as closed, create a new subpath whose
first point is the same as the previous subpath's first point, and
finally add this new subpath to the path. (If the last subpath had
more than one point in its list of points, then this is equivalent
to adding a straight line connecting the last point back to the
first point, thus "closing" the shape, and then repeating the last
<code title="dom-context-2d-moveTo">moveTo()</code> call.)</p>
finally add this new subpath to the path.</p>

<p class="note">If the last subpath had more than one point in its
list of points, then this is equivalent to adding a straight line
connecting the last point back to the first point, thus "closing"
the shape, and then repeating the last (possibly implied) <code
title="dom-context-2d-moveTo">moveTo()</code> call.</p>


<p>New points and the lines connecting them are added to subpaths
Expand All @@ -26530,47 +26541,54 @@ notes on what would need to be defined for dashed lines:


<p>The <dfn title="dom-context-2d-lineTo"><code>lineTo(<var
title="">x</var>, <var title="">y</var>)</code></dfn> method must do
nothing if the context has no subpaths. Otherwise, it must connect
the last point in the subpath to the given point (<var
title="">x</var>, <var title="">y</var>) using a straight line, and
must then add the given point (<var title="">x</var>, <var
title="">y</var>) to the subpath.</p>
title="">x</var>, <var title="">y</var>)</code></dfn> method must
<span>ensure there is a subpath</span> for <span title="">(<var
title="">x</var>, <var title="">y</var>)</span> if the context has
no subpaths. Otherwise, it must connect the last point in the
subpath to the given point (<var title="">x</var>, <var
title="">y</var>) using a straight line, and must then add the given
point (<var title="">x</var>, <var title="">y</var>) to the
subpath.</p>


<p>The <dfn
title="dom-context-2d-quadraticCurveTo"><code>quadraticCurveTo(<var
title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>,
<var title="">y</var>)</code></dfn> method must do nothing if the
context has no subpaths. Otherwise it must connect the last point in
the subpath to the given point (<var title="">x</var>, <var
<var title="">y</var>)</code></dfn> method must <span>ensure there
is a subpath</span> for <span title="">(<var title="">cpx</var>,
<var title="">cpy</var>)</span>, and then must connect the last
point in the subpath to the given point (<var title="">x</var>, <var
title="">y</var>) using a quadratic B&eacute;zier curve with control
point (<var title="">cpx</var>, <var title="">cpy</var>), and must
then add the given point (<var title="">x</var>, <var
title="">y</var>) to the subpath. <a href="#refsBEZIER">[BEZIER]</a></p>
title="">y</var>) to the subpath. <a
href="#refsBEZIER">[BEZIER]</a></p>


<p>The <dfn
title="dom-context-2d-bezierCurveTo"><code>bezierCurveTo(<var
title="">cp1x</var>, <var title="">cp1y</var>, <var
title="">cp2x</var>, <var title="">cp2y</var>, <var
title="">x</var>, <var title="">y</var>)</code></dfn> method must do
nothing if the context has no subpaths. Otherwise, it must connect
the last point in the subpath to the given point (<var
title="">x</var>, <var title="">y</var>)</code></dfn> method must
<span>ensure there is a subpath</span> for <span title="">(<var
title="">cp1x</var>, <var title="">cp1y</var>)</span>, and then must
connect the last point in the subpath to the given point (<var
title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
curve with control points (<var title="">cp1x</var>, <var
title="">cp1y</var>) and (<var title="">cp2x</var>, <var
title="">cp2y</var>). Then, it must add the point (<var
title="">x</var>, <var title="">y</var>) to the subpath. <a
href="#refsBEZIER">[BEZIER]</a></p>

<hr>

<p>The <dfn title="dom-context-2d-arcTo"><code>arcTo(<var
title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
<var title="">y2</var>, <var title="">radius</var>)</code></dfn>
method must do nothing if the context has no subpaths. If the
context <em>does</em> have a subpath, then the behavior depends on
the arguments and the last point in the subpath.</p>
method must first <span>ensure there is a subpath</span> for <span
title="">(<var title="">x1</var>, <var
title="">y1</var>)</span>. Then, the behavior depends on the
arguments and the last point in the subpath, as described below.</p>

<p>Negative values for <var title="">radius</var> must cause the
implementation to raise an <code>INDEX_SIZE_ERR</code>
Expand Down Expand Up @@ -26616,6 +26634,7 @@ notes on what would need to be defined for dashed lines:
title="">The Arc</var>, adding the end tangent point to the
subpath.</p>

<hr>

<p>The <dfn title="dom-context-2d-arc"><code>arc(<var
title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
Expand Down Expand Up @@ -26664,6 +26683,7 @@ notes on what would need to be defined for dashed lines:
implementation to raise an <code>INDEX_SIZE_ERR</code>
exception.</p>

<hr>

<p>The <dfn title="dom-context-2d-rect"><code>rect(<var
title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var
Expand Down

0 comments on commit 7acbbda

Please sign in to comment.