Permalink
Browse files

Editorial: define arc() and ellipse() in terms of shared steps

  • Loading branch information...
annevk committed Jan 12, 2018
1 parent 25c1eef commit af11308332a82f8bc548b3d52f701973575f205f
Showing with 19 additions and 12 deletions.
  1. +19 −12 source
View
31 source
@@ -61725,27 +61725,34 @@ try {
<hr>
<p>The <dfn><code data-x="dom-context-2d-arc">arc(<var>x</var>, <var>y</var>,
<var>radius</var>, <var>startAngle</var>, <var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> and <dfn><code data-x="dom-context-2d-ellipse">ellipse(<var>x</var>, <var>y</var>, <var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>, <var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> methods draw arcs.</p>
<p>The <dfn><code data-x="dom-context-2d-arc">arc(<var>x</var>, <var>y</var>, <var>radius</var>,
<var>startAngle</var>, <var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> method, when
invoked, must run the <span>ellipse method steps</span> with this, <var>x</var>, <var>y</var>,
<var>radius</var>, <var>radius</var>, 0, <var>startAngle</var>, <var>endAngle</var>, and
<var>anticlockwise</var>.</p>
<p>The <code data-x="dom-context-2d-arc">arc()</code> method is equivalent to the <code
data-x="dom-context-2d-ellipse">ellipse()</code> method in the case where the two radii are equal.
When the <code data-x="dom-context-2d-arc">arc()</code> method is invoked, it must act as if the
<code data-x="dom-context-2d-ellipse">ellipse()</code> method had been invoked with the <var>radiusX</var> and <var>radiusY</var> arguments set to the value of the <var>radius</var> argument, the <var>rotation</var> argument set to zero, and the
other arguments set to the same values as their identically named arguments on the <code
data-x="dom-context-2d-arc">arc()</code> method.</p>
<p class="note">This makes it equivalent to <code data-x="dom-context-2d-ellipse">ellipse()</code>
except that both radii are equal and <var>rotation</var> is 0.</p>
<p>The <code data-x="dom-context-2d-ellipse">ellipse()</code> method, when invoked, must run these
steps:</p>
<p>The <dfn><code data-x="dom-context-2d-ellipse">ellipse(<var>x</var>, <var>y</var>,
<var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>,
<var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> method, when invoked, must run the
<span>ellipse method steps</span> with this, <var>x</var>, <var>y</var>, <var>radiusX</var>,
<var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>, <var>endAngle</var>, and
<var>anticlockwise</var>.</p>
<p>The <dfn>ellipse method steps</dfn>, given <var>canvasPath</var>, <var>x</var>, <var>y</var>,
<var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>,
<var>endAngle</var>, and <var>anticlockwise</var>, are:
<ol>
<li><p>If any of the arguments are infinite or NaN, then return.</p></li>
<li><p>If either <var>radiusX</var> or <var>radiusY</var> are negative, then throw an
<span>"<code>IndexSizeError</code>"</span> <code>DOMException</code>.</p></li>
<li><p>If the object's path has any subpaths, then add a straight line from the last point in the
subpath to the start point of the arc.</p></li>
<li><p>If <var>canvasPath</var>'s path has any subpaths, then add a straight line from the last
point in the subpath to the start point of the arc.</p></li>
<li>
<p>Add the start and end points of the arc to the subpath, and connect them with an arc. The arc

0 comments on commit af11308

Please sign in to comment.