[html5] r7017 - [e] (0) Factor our the path methods Affected topics: Canvas
whatwg at whatwg.org
whatwg at whatwg.org
Tue Mar 6 15:28:33 PST 2012
Author: ianh
Date: 2012-03-06 15:28:32 -0800 (Tue, 06 Mar 2012)
New Revision: 7017
Modified:
complete.html
index
source
Log:
[e] (0) Factor our the path methods
Affected topics: Canvas
Modified: complete.html
===================================================================
--- complete.html 2012-03-06 23:23:49 UTC (rev 7016)
+++ complete.html 2012-03-06 23:28:32 UTC (rev 7017)
@@ -34904,16 +34904,8 @@
void <a href=#dom-context-2d-fillrect title=dom-context-2d-fillRect>fillRect</a>(double x, double y, double w, double h);
void <a href=#dom-context-2d-strokerect title=dom-context-2d-strokeRect>strokeRect</a>(double x, double y, double w, double h);
- // path API
+ // default path API (see also <a href=#canvaspathmethods>CanvasPathMethods</a>)
void <a href=#dom-context-2d-beginpath title=dom-context-2d-beginPath>beginPath</a>();
- void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
- void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(double x, double y);
- void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(double x, double y);
- void <a href=#dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo>quadraticCurveTo</a>(double cpx, double cpy, double x, double y);
- void <a href=#dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo>bezierCurveTo</a>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
- void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
- void <a href=#dom-context-2d-rect title=dom-context-2d-rect>rect</a>(double x, double y, double w, double h);
- void <a href=#dom-context-2d-arc title=dom-context-2d-arc>arc</a>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
void <a href=#dom-context-2d-fill title=dom-context-2d-fill>fill</a>();
void <a href=#dom-context-2d-stroke title=dom-context-2d-stroke>stroke</a>();
void <a href=#dom-context-2d-drawsystemfocusring title=dom-context-2d-drawSystemFocusRing>drawSystemFocusRing</a>(<a href=#element>Element</a> element);
@@ -34943,6 +34935,7 @@
};
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvastransformation>CanvasTransformation</a>;
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvaslinestyles>CanvasLineStyles</a>;
+<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvaspathmethods>CanvasPathMethods</a>;
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvastext>CanvasText</a>;
[NoInterfaceObject]
@@ -34976,6 +34969,19 @@
attribute DOMString <a href=#dom-context-2d-textbaseline title=dom-context-2d-textBaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
};
+[NoInterfaceObject]
+interface <dfn id=canvaspathmethods>CanvasPathMethods</dfn> {
+ // shared path API methods
+ void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
+ void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(double x, double y);
+ void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(double x, double y);
+ void <a href=#dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo>quadraticCurveTo</a>(double cpx, double cpy, double x, double y);
+ void <a href=#dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo>bezierCurveTo</a>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
+ void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
+ void <a href=#dom-context-2d-rect title=dom-context-2d-rect>rect</a>(double x, double y, double w, double h);
+ void <a href=#dom-context-2d-arc title=dom-context-2d-arc>arc</a>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
+};
+
interface <dfn id=canvasgradient>CanvasGradient</dfn> {
// opaque object
void <a href=#dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop>addColorStop</a>(double offset, DOMString color);
@@ -35067,9 +35073,9 @@
<ul class=brief><li>The current <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>.</li>
<li>The current <a href=#clipping-region>clipping region</a>.</li>
<li>The current values of the following attributes: <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>, <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code>, <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>, <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code>, <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shado
wblur>shadowBlur</a></code>, <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>, <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>, <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>.</li>
- </ul><p class=note>The current path and the current bitmap are not part
- of the drawing state. The current path is persistent, and can only
- be reset using the <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The
+ </ul><p class=note>The current default path and the current bitmap are
+ not part of the drawing state. The current default path is
+ persistent, and can only be reset using the <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The
current bitmap is a property of the canvas, not the context.</p>
<dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-save><a href=#dom-context-2d-save>save</a></code>()</dt>
@@ -36125,9 +36131,9 @@
<span title=""><var title="">y</var>+<var title="">h</var></span>)</span>,
<span title="">(<var title="">x</var>, <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>.</p>
- <p>Shapes are painted without affecting the current path, and are
- subject to the <a href=#clipping-region title="clipping region">clipping region</a>,
- and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ <p>Shapes are painted without affecting the current default path,
+ and are subject to the <a href=#clipping-region title="clipping region">clipping
+ region</a>, and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>
</div>
@@ -36180,29 +36186,23 @@
<h6 id=complex-shapes-(paths)><span class=secno>4.8.11.1.8 </span>Complex shapes (paths)</h6>
- <p>The context always has a current path. There is only one current
- path, it is not part of the <a href=#drawing-state>drawing state</a>.</p>
+ <p>Each object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
+ interface has a <a href=#path>path</a>. A <dfn id=path>path</dfn> has a list of
+ zero or more subpaths. Each subpath consists of a list of one or
+ more points, connected by straight or curved lines, and a flag
+ indicating whether the subpath is closed or not. A closed subpath is
+ one where the last point of the subpath is connected to the first
+ point of the subpath by a straight line. Subpaths with fewer than
+ two points are ignored when painting the path.</p>
- <p>A <dfn id=path>path</dfn> has a list of zero or more subpaths. Each
- subpath consists of a list of one or more points, connected by
- straight or curved lines, and a flag indicating whether the subpath
- is closed or not. A closed subpath is one where the last point of
- the subpath is connected to the first point of the subpath by a
- straight line. Subpaths with fewer than two points are ignored when
- painting the path.</p>
+ <p>When an object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
+ interface is created, its <a href=#path>path</a> must be initialized to
+ zero subpaths.</p>
- <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
<dd>
- <p>Resets the current path.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
-
- <dd>
-
<p>Creates a new subpath with the given point.</p>
</dd>
@@ -36275,106 +36275,41 @@
</dd>
- <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
-
- <dd>
-
- <p>Fills the subpaths with the current fill style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
-
- <dd>
-
- <p>Strokes the subpaths with the current stroke style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, draws a focus ring around the
- current path, following the platform conventions for focus
- rings.</p>
-
- </dd>
-
- <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, and the user has configured
- his system to draw focus rings in a particular manner (for
- example, high contrast focus rings), draws a focus ring around the
- current path and returns false.</p>
-
- <p>Otherwise, returns true if the given element is focused, and
- false otherwise. This can thus be used to determine when to draw a
- focus ring (see <a href=#drawCustomFocusRingExample>the
- example</a> below).</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()</dt>
-
- <dd>
-
- <p>Scrolls the current path into view. This is especially useful
- on devices with small screens, where the whole canvas might not be
- visible at once.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
-
- <dd>
-
- <p>Further constrains the clipping region to the given path.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
-
- <dd>
-
- <p>Returns true if the given point is in the current path.</p>
-
- </dd>
-
</dl><div class=impl>
- <p>Initially, the context's path must have zero subpaths.</p>
+ <p>The following methods allow authors to manipulate the <a href=#path title=path>paths</a> of objects implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface.</p>
- <p>The points and lines added to the path by these methods must be
- transformed according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
- matrix</a> as they are added.</p>
+ <p>The points and lines added to an object's <a href=#path>path</a> by
+ these methods must be transformed according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a> of the object implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface before they are added to
+ the path.</p>
+ <p class=note>All objects implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface also implement the
+ <code><a href=#canvastransformation>CanvasTransformation</a></code> interface, and thus have a <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a>.</p>
- <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
- method must empty the list of subpaths so that the context once
- again has zero subpaths.</p>
-
<p>The <dfn id=dom-context-2d-moveto title=dom-context-2d-moveTo><code>moveTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
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>
+ for a coordinate (<var title="">x</var>, <var title="">y</var>) on a
+ <a href=#path>path</a>, the user agent must check to see if the
+ <a href=#path>path</a> 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.</p>
+ method must do nothing if the object's path 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.</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
@@ -36384,12 +36319,12 @@
<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>
+ modify the last subpath in the object's path.</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
+ <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 object's path
+ 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>
@@ -36450,11 +36385,11 @@
<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
- arc. In any case, it must draw the arc between the start point of
- the arc and the end point of the arc, and add the start and end
- points of the arc to the subpath. The arc and its start and end
+ the object's path has any subpaths, then the method must add a
+ straight line from the last point in the subpath to the start point
+ of the arc. In any case, it must draw the arc between the start
+ point of the arc and the end point of the arc, and add the start and
+ end points of the arc to the subpath. The arc and its start and end
points are defined as follows:</p>
<p>Consider a circle that has its origin at (<var title="">x</var>,
@@ -36474,9 +36409,9 @@
if the <var title="">anticlockwise</var> argument is true, and
clockwise otherwise. Since the points are on the circle, as opposed
to being simply angles from zero, the arc can never cover an angle
- greater than <span title="">2π</span> radians. If the two points are the
- same, or if the radius is zero, then the arc is defined as being of
- zero length in both directions.</p>
+ greater than <span title="">2π</span> radians. If the two points
+ are the same, or if the radius is zero, then the arc is defined as
+ being of zero length in both directions.</p>
<p>Negative values for <var title="">radius</var> must cause the
implementation to throw an <code><a href=#indexsizeerror>IndexSizeError</a></code>
@@ -36495,9 +36430,99 @@
http://home.comcast.net/~urbanjost/canvas/vogle4.html
-->
+ </div>
+ <hr><!-- XXX make this a new section --><p>The context always has a current default path. There is only one
+ current default path, it is not part of the <a href=#drawing-state>drawing
+ state</a>. The current default path is a <a href=#path>path</a>, as
+ described in the previous section.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>
+
+ <dd>
+
+ <p>Resets the current default path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
+
+ <dd>
+
+ <p>Fills the subpaths of the current default path with the current fill style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
+
+ <dd>
+
+ <p>Strokes the subpaths of the currnet default path with the current stroke style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, draws a focus ring around the
+ current default path, following the platform conventions for focus
+ rings.</p>
+
+ </dd>
+
+ <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, and the user has configured
+ his system to draw focus rings in a particular manner (for
+ example, high contrast focus rings), draws a focus ring around the
+ current default path and returns false.</p>
+
+ <p>Otherwise, returns true if the given element is focused, and
+ false otherwise. This can thus be used to determine when to draw a
+ focus ring (see <a href=#drawCustomFocusRingExample>the
+ example</a> below).</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()</dt>
+
+ <dd>
+
+ <p>Scrolls the current default path into view. This is especially
+ useful on devices with small screens, where the whole canvas might
+ not be visible at once.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
+
+ <dd>
+
+ <p>Further constrains the clipping region to the current default
+ path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Returns true if the given point is in the current default
+ path.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
+ method must empty the list of subpaths in the context's current
+ default path so that the it once again has zero subpaths.</p>
+
<p>The <dfn id=dom-context-2d-fill title=dom-context-2d-fill><code>fill()</code></dfn>
- method must fill all the subpaths of the current path, using
+ method must fill all the subpaths of the current default path, using
<code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, and using
the non-zero winding number rule. Open subpaths must be implicitly
closed when being filled (without affecting the actual
@@ -36509,19 +36534,17 @@
once.</p>
<p>The <dfn id=dom-context-2d-stroke title=dom-context-2d-stroke><code>stroke()</code></dfn> method
- must calculate the strokes of all the subpaths of the current path,
- using the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>,
- <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
+ must calculate the strokes of all the subpaths of the current
+ default path, using the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
appropriate) <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attributes, and
- then fill the combined stroke area using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>
- attribute.</p>
+ then fill the combined stroke area using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute.</p>
<p class=note>Since the subpaths are all stroked as one,
overlapping parts of the paths in one stroke operation are treated
as if their union was what was painted.</p>
<p>Paths, when filled or stroked, must be painted without affecting
- the current path, and must be subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ the current default path, and must be subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>. (Transformations affect the path when the path is
created, not when it is painted, though the stroke <em>style</em> is
still affected by the transformation during painting.)</p>
@@ -36540,8 +36563,9 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), or if the <var title="">element</var> would have a focus ring drawn around it,
- then draw a focus ring of the appropriate style along the path,
- following platform conventions, and abort these steps.</p>
+ then draw a focus ring of the appropriate style along the current
+ default path, following platform conventions, and abort these
+ steps.</p>
<p class=note>Some platforms only draw focus rings around
elements that have been focused from the keyboard, and not those
@@ -36562,9 +36586,10 @@
<li>
<p>Optionally, <a href=#inform>inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <a href=#event-loop>event loop</a> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <a href=#event-loop>event loop</a>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -36579,8 +36604,8 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), then draw a focus ring of the
- appropriate style along the path, return false, and abort these
- steps.</p>
+ appropriate style along the current default path, return false,
+ and abort these steps.</p>
<p>The focus ring should not be subject to the <a href=#shadows title=shadows>shadow effects</a>, the <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, or the <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>, but <em>should</em> be subject to the <a href=#clipping-region title="clipping region">clipping region</a>.</p>
@@ -36590,9 +36615,10 @@
<li>
<p>Optionally, <a href=#inform>inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <a href=#event-loop>event loop</a> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <a href=#event-loop>event loop</a>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -36604,7 +36630,7 @@
<ol><li><p>Let <var title="">notional child</var> be a hypothetical
element that is a rendered child of the <code><a href=#the-canvas-element>canvas</a></code> element
whose dimensions are exactly the rectangle of the bounding box of
- the current path.</li>
+ the current default path.</li>
<li><p><a href=#scroll-an-element-into-view title="scroll an element into view">Scroll <var title="">notional child</var> into view</a> with the <var title="">align to top flag</var> set.</p>
@@ -36629,9 +36655,9 @@
<hr><p>The <dfn id=dom-context-2d-clip title=dom-context-2d-clip><code>clip()</code></dfn>
method must create a new <dfn id=clipping-region>clipping region</dfn> by calculating
the intersection of the current clipping region and the area
- described by the current path, using the non-zero winding number
- rule. Open subpaths must be implicitly closed when computing the
- clipping region, without affecting the actual subpaths. The new
+ described by the current default path, using the non-zero winding
+ number rule. Open subpaths must be implicitly closed when computing
+ the clipping region, without affecting the actual subpaths. The new
clipping region replaces the current clipping region.</p>
<p>When the context is initialized, the clipping region must be set
@@ -36652,11 +36678,11 @@
<hr><p>The <dfn id=dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath><code>isPointInPath(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
return true if the point given by the <var title="">x</var> and <var title="">y</var> coordinates passed to the method, when treated as
coordinates in the canvas coordinate space unaffected by the current
- transformation, is inside the current path as determined by the
- non-zero winding number rule; and must return false
- otherwise. Points on the path itself are considered to be inside the
- path. If either of the arguments is infinite or NaN, then the method
- must return false.</p>
+ transformation, is inside the current default path as determined by
+ the non-zero winding number rule; and must return false otherwise.
+ Points on the path itself must be considered to be inside the path.
+ If either of the arguments is infinite or NaN, then the method must
+ return false.</p>
</div>
Modified: index
===================================================================
--- index 2012-03-06 23:23:49 UTC (rev 7016)
+++ index 2012-03-06 23:28:32 UTC (rev 7017)
@@ -34904,16 +34904,8 @@
void <a href=#dom-context-2d-fillrect title=dom-context-2d-fillRect>fillRect</a>(double x, double y, double w, double h);
void <a href=#dom-context-2d-strokerect title=dom-context-2d-strokeRect>strokeRect</a>(double x, double y, double w, double h);
- // path API
+ // default path API (see also <a href=#canvaspathmethods>CanvasPathMethods</a>)
void <a href=#dom-context-2d-beginpath title=dom-context-2d-beginPath>beginPath</a>();
- void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
- void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(double x, double y);
- void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(double x, double y);
- void <a href=#dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo>quadraticCurveTo</a>(double cpx, double cpy, double x, double y);
- void <a href=#dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo>bezierCurveTo</a>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
- void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
- void <a href=#dom-context-2d-rect title=dom-context-2d-rect>rect</a>(double x, double y, double w, double h);
- void <a href=#dom-context-2d-arc title=dom-context-2d-arc>arc</a>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
void <a href=#dom-context-2d-fill title=dom-context-2d-fill>fill</a>();
void <a href=#dom-context-2d-stroke title=dom-context-2d-stroke>stroke</a>();
void <a href=#dom-context-2d-drawsystemfocusring title=dom-context-2d-drawSystemFocusRing>drawSystemFocusRing</a>(<a href=#element>Element</a> element);
@@ -34943,6 +34935,7 @@
};
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvastransformation>CanvasTransformation</a>;
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvaslinestyles>CanvasLineStyles</a>;
+<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvaspathmethods>CanvasPathMethods</a>;
<a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a> implements <a href=#canvastext>CanvasText</a>;
[NoInterfaceObject]
@@ -34976,6 +34969,19 @@
attribute DOMString <a href=#dom-context-2d-textbaseline title=dom-context-2d-textBaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
};
+[NoInterfaceObject]
+interface <dfn id=canvaspathmethods>CanvasPathMethods</dfn> {
+ // shared path API methods
+ void <a href=#dom-context-2d-closepath title=dom-context-2d-closePath>closePath</a>();
+ void <a href=#dom-context-2d-moveto title=dom-context-2d-moveTo>moveTo</a>(double x, double y);
+ void <a href=#dom-context-2d-lineto title=dom-context-2d-lineTo>lineTo</a>(double x, double y);
+ void <a href=#dom-context-2d-quadraticcurveto title=dom-context-2d-quadraticCurveTo>quadraticCurveTo</a>(double cpx, double cpy, double x, double y);
+ void <a href=#dom-context-2d-beziercurveto title=dom-context-2d-bezierCurveTo>bezierCurveTo</a>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
+ void <a href=#dom-context-2d-arcto title=dom-context-2d-arcTo>arcTo</a>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
+ void <a href=#dom-context-2d-rect title=dom-context-2d-rect>rect</a>(double x, double y, double w, double h);
+ void <a href=#dom-context-2d-arc title=dom-context-2d-arc>arc</a>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
+};
+
interface <dfn id=canvasgradient>CanvasGradient</dfn> {
// opaque object
void <a href=#dom-canvasgradient-addcolorstop title=dom-canvasgradient-addColorStop>addColorStop</a>(double offset, DOMString color);
@@ -35067,9 +35073,9 @@
<ul class=brief><li>The current <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>.</li>
<li>The current <a href=#clipping-region>clipping region</a>.</li>
<li>The current values of the following attributes: <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, <code title=dom-context-2d-globalAlpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>, <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code>, <code title=dom-context-2d-shadowOffsetX><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>, <code title=dom-context-2d-shadowOffsetY><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code>, <code title=dom-context-2d-shadowBlur><a href=#dom-context-2d-shado
wblur>shadowBlur</a></code>, <code title=dom-context-2d-shadowColor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>, <code title=dom-context-2d-globalCompositeOperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>, <code title=dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code title=dom-context-2d-textAlign><a href=#dom-context-2d-textalign>textAlign</a></code>, <code title=dom-context-2d-textBaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>.</li>
- </ul><p class=note>The current path and the current bitmap are not part
- of the drawing state. The current path is persistent, and can only
- be reset using the <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The
+ </ul><p class=note>The current default path and the current bitmap are
+ not part of the drawing state. The current default path is
+ persistent, and can only be reset using the <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The
current bitmap is a property of the canvas, not the context.</p>
<dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-save><a href=#dom-context-2d-save>save</a></code>()</dt>
@@ -36125,9 +36131,9 @@
<span title=""><var title="">y</var>+<var title="">h</var></span>)</span>,
<span title="">(<var title="">x</var>, <span title=""><var title="">y</var>+<var title="">h</var></span>)</span>.</p>
- <p>Shapes are painted without affecting the current path, and are
- subject to the <a href=#clipping-region title="clipping region">clipping region</a>,
- and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ <p>Shapes are painted without affecting the current default path,
+ and are subject to the <a href=#clipping-region title="clipping region">clipping
+ region</a>, and, with the exception of <code title=dom-context-2d-clearRect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>
</div>
@@ -36180,29 +36186,23 @@
<h6 id=complex-shapes-(paths)><span class=secno>4.8.11.1.8 </span>Complex shapes (paths)</h6>
- <p>The context always has a current path. There is only one current
- path, it is not part of the <a href=#drawing-state>drawing state</a>.</p>
+ <p>Each object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
+ interface has a <a href=#path>path</a>. A <dfn id=path>path</dfn> has a list of
+ zero or more subpaths. Each subpath consists of a list of one or
+ more points, connected by straight or curved lines, and a flag
+ indicating whether the subpath is closed or not. A closed subpath is
+ one where the last point of the subpath is connected to the first
+ point of the subpath by a straight line. Subpaths with fewer than
+ two points are ignored when painting the path.</p>
- <p>A <dfn id=path>path</dfn> has a list of zero or more subpaths. Each
- subpath consists of a list of one or more points, connected by
- straight or curved lines, and a flag indicating whether the subpath
- is closed or not. A closed subpath is one where the last point of
- the subpath is connected to the first point of the subpath by a
- straight line. Subpaths with fewer than two points are ignored when
- painting the path.</p>
+ <p>When an object implementing the <code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
+ interface is created, its <a href=#path>path</a> must be initialized to
+ zero subpaths.</p>
- <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
<dd>
- <p>Resets the current path.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-moveTo><a href=#dom-context-2d-moveto>moveTo</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
-
- <dd>
-
<p>Creates a new subpath with the given point.</p>
</dd>
@@ -36275,106 +36275,41 @@
</dd>
- <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
-
- <dd>
-
- <p>Fills the subpaths with the current fill style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
-
- <dd>
-
- <p>Strokes the subpaths with the current stroke style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, draws a focus ring around the
- current path, following the platform conventions for focus
- rings.</p>
-
- </dd>
-
- <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, and the user has configured
- his system to draw focus rings in a particular manner (for
- example, high contrast focus rings), draws a focus ring around the
- current path and returns false.</p>
-
- <p>Otherwise, returns true if the given element is focused, and
- false otherwise. This can thus be used to determine when to draw a
- focus ring (see <a href=#drawCustomFocusRingExample>the
- example</a> below).</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()</dt>
-
- <dd>
-
- <p>Scrolls the current path into view. This is especially useful
- on devices with small screens, where the whole canvas might not be
- visible at once.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
-
- <dd>
-
- <p>Further constrains the clipping region to the given path.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
-
- <dd>
-
- <p>Returns true if the given point is in the current path.</p>
-
- </dd>
-
</dl><div class=impl>
- <p>Initially, the context's path must have zero subpaths.</p>
+ <p>The following methods allow authors to manipulate the <a href=#path title=path>paths</a> of objects implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface.</p>
- <p>The points and lines added to the path by these methods must be
- transformed according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
- matrix</a> as they are added.</p>
+ <p>The points and lines added to an object's <a href=#path>path</a> by
+ these methods must be transformed according to the <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a> of the object implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface before they are added to
+ the path.</p>
+ <p class=note>All objects implementing the
+ <code><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface also implement the
+ <code><a href=#canvastransformation>CanvasTransformation</a></code> interface, and thus have a <a href=#transformations title=dom-context-2d-transformation>current transformation
+ matrix</a>.</p>
- <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
- method must empty the list of subpaths so that the context once
- again has zero subpaths.</p>
-
<p>The <dfn id=dom-context-2d-moveto title=dom-context-2d-moveTo><code>moveTo(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
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>
+ for a coordinate (<var title="">x</var>, <var title="">y</var>) on a
+ <a href=#path>path</a>, the user agent must check to see if the
+ <a href=#path>path</a> 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.</p>
+ method must do nothing if the object's path 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.</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
@@ -36384,12 +36319,12 @@
<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>
+ modify the last subpath in the object's path.</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
+ <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 object's path
+ 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>
@@ -36450,11 +36385,11 @@
<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
- arc. In any case, it must draw the arc between the start point of
- the arc and the end point of the arc, and add the start and end
- points of the arc to the subpath. The arc and its start and end
+ the object's path has any subpaths, then the method must add a
+ straight line from the last point in the subpath to the start point
+ of the arc. In any case, it must draw the arc between the start
+ point of the arc and the end point of the arc, and add the start and
+ end points of the arc to the subpath. The arc and its start and end
points are defined as follows:</p>
<p>Consider a circle that has its origin at (<var title="">x</var>,
@@ -36474,9 +36409,9 @@
if the <var title="">anticlockwise</var> argument is true, and
clockwise otherwise. Since the points are on the circle, as opposed
to being simply angles from zero, the arc can never cover an angle
- greater than <span title="">2π</span> radians. If the two points are the
- same, or if the radius is zero, then the arc is defined as being of
- zero length in both directions.</p>
+ greater than <span title="">2π</span> radians. If the two points
+ are the same, or if the radius is zero, then the arc is defined as
+ being of zero length in both directions.</p>
<p>Negative values for <var title="">radius</var> must cause the
implementation to throw an <code><a href=#indexsizeerror>IndexSizeError</a></code>
@@ -36495,9 +36430,99 @@
http://home.comcast.net/~urbanjost/canvas/vogle4.html
-->
+ </div>
+ <hr><!-- XXX make this a new section --><p>The context always has a current default path. There is only one
+ current default path, it is not part of the <a href=#drawing-state>drawing
+ state</a>. The current default path is a <a href=#path>path</a>, as
+ described in the previous section.</p>
+
+ <dl class=domintro><dt><var title="">context</var> . <code title=dom-context-2d-beginPath><a href=#dom-context-2d-beginpath>beginPath</a></code>()</dt>
+
+ <dd>
+
+ <p>Resets the current default path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>()</dt>
+
+ <dd>
+
+ <p>Fills the subpaths of the current default path with the current fill style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()</dt>
+
+ <dd>
+
+ <p>Strokes the subpaths of the currnet default path with the current stroke style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-drawSystemFocusRing><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, draws a focus ring around the
+ current default path, following the platform conventions for focus
+ rings.</p>
+
+ </dd>
+
+ <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title=dom-context-2d-drawCustomFocusRing><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, and the user has configured
+ his system to draw focus rings in a particular manner (for
+ example, high contrast focus rings), draws a focus ring around the
+ current default path and returns false.</p>
+
+ <p>Otherwise, returns true if the given element is focused, and
+ false otherwise. This can thus be used to determine when to draw a
+ focus ring (see <a href=#drawCustomFocusRingExample>the
+ example</a> below).</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-scrollPathIntoView><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()</dt>
+
+ <dd>
+
+ <p>Scrolls the current default path into view. This is especially
+ useful on devices with small screens, where the whole canvas might
+ not be visible at once.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>()</dt>
+
+ <dd>
+
+ <p>Further constrains the clipping region to the current default
+ path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title=dom-context-2d-isPointInPath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Returns true if the given point is in the current default
+ path.</p>
+
+ </dd>
+
+ </dl><div class=impl>
+
+ <p>The <dfn id=dom-context-2d-beginpath title=dom-context-2d-beginPath><code>beginPath()</code></dfn>
+ method must empty the list of subpaths in the context's current
+ default path so that the it once again has zero subpaths.</p>
+
<p>The <dfn id=dom-context-2d-fill title=dom-context-2d-fill><code>fill()</code></dfn>
- method must fill all the subpaths of the current path, using
+ method must fill all the subpaths of the current default path, using
<code title=dom-context-2d-fillStyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, and using
the non-zero winding number rule. Open subpaths must be implicitly
closed when being filled (without affecting the actual
@@ -36509,19 +36534,17 @@
once.</p>
<p>The <dfn id=dom-context-2d-stroke title=dom-context-2d-stroke><code>stroke()</code></dfn> method
- must calculate the strokes of all the subpaths of the current path,
- using the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>,
- <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
+ must calculate the strokes of all the subpaths of the current
+ default path, using the <code title=dom-context-2d-lineWidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code title=dom-context-2d-lineCap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code title=dom-context-2d-lineJoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, and (if
appropriate) <code title=dom-context-2d-miterLimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attributes, and
- then fill the combined stroke area using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>
- attribute.</p>
+ then fill the combined stroke area using the <code title=dom-context-2d-strokeStyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute.</p>
<p class=note>Since the subpaths are all stroked as one,
overlapping parts of the paths in one stroke operation are treated
as if their union was what was painted.</p>
<p>Paths, when filled or stroked, must be painted without affecting
- the current path, and must be subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
+ the current default path, and must be subject to <a href=#shadows title=shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the <a href=#clipping-region title="clipping region">clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>. (Transformations affect the path when the path is
created, not when it is painted, though the stroke <em>style</em> is
still affected by the transformation during painting.)</p>
@@ -36540,8 +36563,9 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), or if the <var title="">element</var> would have a focus ring drawn around it,
- then draw a focus ring of the appropriate style along the path,
- following platform conventions, and abort these steps.</p>
+ then draw a focus ring of the appropriate style along the current
+ default path, following platform conventions, and abort these
+ steps.</p>
<p class=note>Some platforms only draw focus rings around
elements that have been focused from the keyboard, and not those
@@ -36562,9 +36586,10 @@
<li>
<p>Optionally, <a href=#inform>inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <a href=#event-loop>event loop</a> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <a href=#event-loop>event loop</a>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -36579,8 +36604,8 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), then draw a focus ring of the
- appropriate style along the path, return false, and abort these
- steps.</p>
+ appropriate style along the current default path, return false,
+ and abort these steps.</p>
<p>The focus ring should not be subject to the <a href=#shadows title=shadows>shadow effects</a>, the <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, or the <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>, but <em>should</em> be subject to the <a href=#clipping-region title="clipping region">clipping region</a>.</p>
@@ -36590,9 +36615,10 @@
<li>
<p>Optionally, <a href=#inform>inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <a href=#event-loop>event loop</a> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <a href=#event-loop>event loop</a>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -36604,7 +36630,7 @@
<ol><li><p>Let <var title="">notional child</var> be a hypothetical
element that is a rendered child of the <code><a href=#the-canvas-element>canvas</a></code> element
whose dimensions are exactly the rectangle of the bounding box of
- the current path.</li>
+ the current default path.</li>
<li><p><a href=#scroll-an-element-into-view title="scroll an element into view">Scroll <var title="">notional child</var> into view</a> with the <var title="">align to top flag</var> set.</p>
@@ -36629,9 +36655,9 @@
<hr><p>The <dfn id=dom-context-2d-clip title=dom-context-2d-clip><code>clip()</code></dfn>
method must create a new <dfn id=clipping-region>clipping region</dfn> by calculating
the intersection of the current clipping region and the area
- described by the current path, using the non-zero winding number
- rule. Open subpaths must be implicitly closed when computing the
- clipping region, without affecting the actual subpaths. The new
+ described by the current default path, using the non-zero winding
+ number rule. Open subpaths must be implicitly closed when computing
+ the clipping region, without affecting the actual subpaths. The new
clipping region replaces the current clipping region.</p>
<p>When the context is initialized, the clipping region must be set
@@ -36652,11 +36678,11 @@
<hr><p>The <dfn id=dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath><code>isPointInPath(<var title="">x</var>, <var title="">y</var>)</code></dfn> method must
return true if the point given by the <var title="">x</var> and <var title="">y</var> coordinates passed to the method, when treated as
coordinates in the canvas coordinate space unaffected by the current
- transformation, is inside the current path as determined by the
- non-zero winding number rule; and must return false
- otherwise. Points on the path itself are considered to be inside the
- path. If either of the arguments is infinite or NaN, then the method
- must return false.</p>
+ transformation, is inside the current default path as determined by
+ the non-zero winding number rule; and must return false otherwise.
+ Points on the path itself must be considered to be inside the path.
+ If either of the arguments is infinite or NaN, then the method must
+ return false.</p>
</div>
Modified: source
===================================================================
--- source 2012-03-06 23:23:49 UTC (rev 7016)
+++ source 2012-03-06 23:28:32 UTC (rev 7017)
@@ -40586,16 +40586,8 @@
void <span title="dom-context-2d-fillRect">fillRect</span>(double x, double y, double w, double h);
void <span title="dom-context-2d-strokeRect">strokeRect</span>(double x, double y, double w, double h);
- // path API
+ // default path API (see also <span>CanvasPathMethods</span>)
void <span title="dom-context-2d-beginPath">beginPath</span>();
- void <span title="dom-context-2d-closePath">closePath</span>();
- void <span title="dom-context-2d-moveTo">moveTo</span>(double x, double y);
- void <span title="dom-context-2d-lineTo">lineTo</span>(double x, double y);
- void <span title="dom-context-2d-quadraticCurveTo">quadraticCurveTo</span>(double cpx, double cpy, double x, double y);
- void <span title="dom-context-2d-bezierCurveTo">bezierCurveTo</span>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
- void <span title="dom-context-2d-arcTo">arcTo</span>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
- void <span title="dom-context-2d-rect">rect</span>(double x, double y, double w, double h);
- void <span title="dom-context-2d-arc">arc</span>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
void <span title="dom-context-2d-fill">fill</span>();
void <span title="dom-context-2d-stroke">stroke</span>();
void <span title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</span>(<span>Element</span> element);
@@ -40625,6 +40617,7 @@
};
<span>CanvasRenderingContext2D</span> implements <span>CanvasTransformation</span>;
<span>CanvasRenderingContext2D</span> implements <span>CanvasLineStyles</span>;
+<span>CanvasRenderingContext2D</span> implements <span>CanvasPathMethods</span>;
<span>CanvasRenderingContext2D</span> implements <span>CanvasText</span>;
[NoInterfaceObject]
@@ -40658,6 +40651,19 @@
attribute DOMString <span title="dom-context-2d-textBaseline">textBaseline</span>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
};
+[NoInterfaceObject]
+interface <dfn>CanvasPathMethods</dfn> {
+ // shared path API methods
+ void <span title="dom-context-2d-closePath">closePath</span>();
+ void <span title="dom-context-2d-moveTo">moveTo</span>(double x, double y);
+ void <span title="dom-context-2d-lineTo">lineTo</span>(double x, double y);
+ void <span title="dom-context-2d-quadraticCurveTo">quadraticCurveTo</span>(double cpx, double cpy, double x, double y);
+ void <span title="dom-context-2d-bezierCurveTo">bezierCurveTo</span>(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
+ void <span title="dom-context-2d-arcTo">arcTo</span>(double x1, double y1, double x2, double y2, double radius); <!-- see ARC-ORDER note below -->
+ void <span title="dom-context-2d-rect">rect</span>(double x, double y, double w, double h);
+ void <span title="dom-context-2d-arc">arc</span>(double x, double y, double radius, double startAngle, double endAngle, optional boolean anticlockwise); <!-- see ARC-ORDER note below -->
+};
+
interface <dfn>CanvasGradient</dfn> {
// opaque object
void <span title="dom-canvasgradient-addColorStop">addColorStop</span>(double offset, DOMString color);
@@ -40775,9 +40781,9 @@
title="dom-context-2d-textBaseline">textBaseline</code>.</li>
</ul>
- <p class="note">The current path and the current bitmap are not part
- of the drawing state. The current path is persistent, and can only
- be reset using the <code
+ <p class="note">The current default path and the current bitmap are
+ not part of the drawing state. The current default path is
+ persistent, and can only be reset using the <code
title="dom-context-2d-beginPath">beginPath()</code> method. The
current bitmap is a property of the canvas, not the context.</p>
@@ -42040,9 +42046,9 @@
<span title="">(<var title="">x</var>, <span title=""><var title="">y</var>+<var
title="">h</var></span>)</span>.</p>
- <p>Shapes are painted without affecting the current path, and are
- subject to the <span title="clipping region">clipping region</span>,
- and, with the exception of <code
+ <p>Shapes are painted without affecting the current default path,
+ and are subject to the <span title="clipping region">clipping
+ region</span>, and, with the exception of <code
title="dom-context-2d-clearRect">clearRect()</code>, also <span
title="shadows">shadow effects</span>, <span
title="dom-context-2d-globalAlpha">global alpha</span>, and <span
@@ -42114,27 +42120,21 @@
<h6>Complex shapes (paths)</h6>
- <p>The context always has a current path. There is only one current
- path, it is not part of the <span>drawing state</span>.</p>
+ <p>Each object implementing the <code>CanvasPathMethods</code>
+ interface has a <span>path</span>. A <dfn>path</dfn> has a list of
+ zero or more subpaths. Each subpath consists of a list of one or
+ more points, connected by straight or curved lines, and a flag
+ indicating whether the subpath is closed or not. A closed subpath is
+ one where the last point of the subpath is connected to the first
+ point of the subpath by a straight line. Subpaths with fewer than
+ two points are ignored when painting the path.</p>
- <p>A <dfn>path</dfn> has a list of zero or more subpaths. Each
- subpath consists of a list of one or more points, connected by
- straight or curved lines, and a flag indicating whether the subpath
- is closed or not. A closed subpath is one where the last point of
- the subpath is connected to the first point of the subpath by a
- straight line. Subpaths with fewer than two points are ignored when
- painting the path.</p>
+ <p>When an object implementing the <code>CanvasPathMethods</code>
+ interface is created, its <span>path</span> must be initialized to
+ zero subpaths.</p>
<dl class="domintro">
- <dt><var title="">context</var> . <code title="dom-context-2d-beginPath">beginPath</code>()</dt>
-
- <dd>
-
- <p>Resets the current path.</p>
-
- </dd>
-
<dt><var title="">context</var> . <code title="dom-context-2d-moveTo">moveTo</code>(<var title="">x</var>, <var title="">y</var>)</dt>
<dd>
@@ -42211,113 +42211,49 @@
</dd>
- <dt><var title="">context</var> . <code title="dom-context-2d-fill">fill</code>()</dt>
-
- <dd>
-
- <p>Fills the subpaths with the current fill style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title="dom-context-2d-stroke">stroke</code>()</dt>
-
- <dd>
-
- <p>Strokes the subpaths with the current stroke style.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, draws a focus ring around the
- current path, following the platform conventions for focus
- rings.</p>
-
- </dd>
-
- <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</code>(<var title="">element</var>)</dt>
-
- <dd>
-
- <p>If the given element is focused, and the user has configured
- his system to draw focus rings in a particular manner (for
- example, high contrast focus rings), draws a focus ring around the
- current path and returns false.</p>
-
- <p>Otherwise, returns true if the given element is focused, and
- false otherwise. This can thus be used to determine when to draw a
- focus ring (see <a href="#drawCustomFocusRingExample">the
- example</a> below).</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</code>()</dt>
-
- <dd>
-
- <p>Scrolls the current path into view. This is especially useful
- on devices with small screens, where the whole canvas might not be
- visible at once.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title="dom-context-2d-clip">clip</code>()</dt>
-
- <dd>
-
- <p>Further constrains the clipping region to the given path.</p>
-
- </dd>
-
- <dt><var title="">context</var> . <code title="dom-context-2d-isPointInPath">isPointInPath</code>(<var title="">x</var>, <var title="">y</var>)</dt>
-
- <dd>
-
- <p>Returns true if the given point is in the current path.</p>
-
- </dd>
-
</dl>
<div class="impl">
- <p>Initially, the context's path must have zero subpaths.</p>
+ <p>The following methods allow authors to manipulate the <span
+ title="path">paths</span> of objects implementing the
+ <code>CanvasPathMethods</code> interface.</p>
- <p>The points and lines added to the path by these methods must be
- transformed according to the <span
+ <p>The points and lines added to an object's <span>path</span> by
+ these methods must be transformed according to the <span
title="dom-context-2d-transformation">current transformation
- matrix</span> as they are added.</p>
+ matrix</span> of the object implementing the
+ <code>CanvasPathMethods</code> interface before they are added to
+ the path.</p>
+ <p class="note">All objects implementing the
+ <code>CanvasPathMethods</code> interface also implement the
+ <code>CanvasTransformation</code> interface, and thus have a <span
+ title="dom-context-2d-transformation">current transformation
+ matrix</span>.</p>
- <p>The <dfn
- title="dom-context-2d-beginPath"><code>beginPath()</code></dfn>
- method must empty the list of subpaths so that the context once
- again has zero subpaths.</p>
-
<p>The <dfn title="dom-context-2d-moveTo"><code>moveTo(<var
title="">x</var>, <var title="">y</var>)</code></dfn> method must
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>
+ for a coordinate (<var title="">x</var>, <var title="">y</var>) on a
+ <span>path</span>, the user agent must check to see if the
+ <span>path</span> 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.</p>
+ method must do nothing if the object's path 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.</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
@@ -42328,14 +42264,14 @@
<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>
+ modify the last subpath in the object's path.</p>
<p>The <dfn title="dom-context-2d-lineTo"><code>lineTo(<var
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
+ title="">x</var>, <var title="">y</var>)</span> if the object's path
+ 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
@@ -42429,11 +42365,11 @@
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
- arc. In any case, it must draw the arc between the start point of
- the arc and the end point of the arc, and add the start and end
- points of the arc to the subpath. The arc and its start and end
+ the object's path has any subpaths, then the method must add a
+ straight line from the last point in the subpath to the start point
+ of the arc. In any case, it must draw the arc between the start
+ point of the arc and the end point of the arc, and add the start and
+ end points of the arc to the subpath. The arc and its start and end
points are defined as follows:</p>
<p>Consider a circle that has its origin at (<var title="">x</var>,
@@ -42457,9 +42393,9 @@
if the <var title="">anticlockwise</var> argument is true, and
clockwise otherwise. Since the points are on the circle, as opposed
to being simply angles from zero, the arc can never cover an angle
- greater than <span title="">2π</span> radians. If the two points are the
- same, or if the radius is zero, then the arc is defined as being of
- zero length in both directions.</p>
+ greater than <span title="">2π</span> radians. If the two points
+ are the same, or if the radius is zero, then the arc is defined as
+ being of zero length in both directions.</p>
<p>Negative values for <var title="">radius</var> must cause the
implementation to throw an <code>IndexSizeError</code>
@@ -42486,9 +42422,106 @@
http://home.comcast.net/~urbanjost/canvas/vogle4.html
-->
+ </div>
+ <hr> <!-- XXX make this a new section -->
+
+ <p>The context always has a current default path. There is only one
+ current default path, it is not part of the <span>drawing
+ state</span>. The current default path is a <span>path</span>, as
+ described in the previous section.</p>
+
+ <dl class="domintro">
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-beginPath">beginPath</code>()</dt>
+
+ <dd>
+
+ <p>Resets the current default path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-fill">fill</code>()</dt>
+
+ <dd>
+
+ <p>Fills the subpaths of the current default path with the current fill style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-stroke">stroke</code>()</dt>
+
+ <dd>
+
+ <p>Strokes the subpaths of the currnet default path with the current stroke style.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, draws a focus ring around the
+ current default path, following the platform conventions for focus
+ rings.</p>
+
+ </dd>
+
+ <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</code>(<var title="">element</var>)</dt>
+
+ <dd>
+
+ <p>If the given element is focused, and the user has configured
+ his system to draw focus rings in a particular manner (for
+ example, high contrast focus rings), draws a focus ring around the
+ current default path and returns false.</p>
+
+ <p>Otherwise, returns true if the given element is focused, and
+ false otherwise. This can thus be used to determine when to draw a
+ focus ring (see <a href="#drawCustomFocusRingExample">the
+ example</a> below).</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</code>()</dt>
+
+ <dd>
+
+ <p>Scrolls the current default path into view. This is especially
+ useful on devices with small screens, where the whole canvas might
+ not be visible at once.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-clip">clip</code>()</dt>
+
+ <dd>
+
+ <p>Further constrains the clipping region to the current default
+ path.</p>
+
+ </dd>
+
+ <dt><var title="">context</var> . <code title="dom-context-2d-isPointInPath">isPointInPath</code>(<var title="">x</var>, <var title="">y</var>)</dt>
+
+ <dd>
+
+ <p>Returns true if the given point is in the current default
+ path.</p>
+
+ </dd>
+
+ </dl>
+
+ <div class="impl">
+
+ <p>The <dfn
+ title="dom-context-2d-beginPath"><code>beginPath()</code></dfn>
+ method must empty the list of subpaths in the context's current
+ default path so that the it once again has zero subpaths.</p>
+
<p>The <dfn title="dom-context-2d-fill"><code>fill()</code></dfn>
- method must fill all the subpaths of the current path, using
+ method must fill all the subpaths of the current default path, using
<code title="dom-context-2d-fillStyle">fillStyle</code>, and using
the non-zero winding number rule. Open subpaths must be implicitly
closed when being filled (without affecting the actual
@@ -42501,22 +42534,22 @@
<p>The <dfn
title="dom-context-2d-stroke"><code>stroke()</code></dfn> method
- must calculate the strokes of all the subpaths of the current path,
- using the <code title="dom-context-2d-lineWidth">lineWidth</code>,
- <code title="dom-context-2d-lineCap">lineCap</code>, <code
+ must calculate the strokes of all the subpaths of the current
+ default path, using the <code
+ title="dom-context-2d-lineWidth">lineWidth</code>, <code
+ title="dom-context-2d-lineCap">lineCap</code>, <code
title="dom-context-2d-lineJoin">lineJoin</code>, and (if
appropriate) <code
title="dom-context-2d-miterLimit">miterLimit</code> attributes, and
then fill the combined stroke area using the <code
- title="dom-context-2d-strokeStyle">strokeStyle</code>
- attribute.</p>
+ title="dom-context-2d-strokeStyle">strokeStyle</code> attribute.</p>
<p class="note">Since the subpaths are all stroked as one,
overlapping parts of the paths in one stroke operation are treated
as if their union was what was painted.</p>
<p>Paths, when filled or stroked, must be painted without affecting
- the current path, and must be subject to <span
+ the current default path, and must be subject to <span
title="shadows">shadow effects</span>, <span
title="dom-context-2d-globalAlpha">global alpha</span>, the <span
title="clipping region">clipping region</span>, and <span
@@ -42546,8 +42579,9 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), or if the <var
title="">element</var> would have a focus ring drawn around it,
- then draw a focus ring of the appropriate style along the path,
- following platform conventions, and abort these steps.</p>
+ then draw a focus ring of the appropriate style along the current
+ default path, following platform conventions, and abort these
+ steps.</p>
<p class="note">Some platforms only draw focus rings around
elements that have been focused from the keyboard, and not those
@@ -42572,9 +42606,10 @@
<li>
<p>Optionally, <a href="#inform">inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <span>event loop</span> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <span>event loop</span>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -42595,8 +42630,8 @@
<p>If the user has requested the use of particular focus rings
(e.g. high-contrast focus rings), then draw a focus ring of the
- appropriate style along the path, return false, and abort these
- steps.</p>
+ appropriate style along the current default path, return false,
+ and abort these steps.</p>
<p>The focus ring should not be subject to the <span
title="shadows">shadow effects</span>, the <span
@@ -42610,9 +42645,10 @@
<li>
<p>Optionally, <a href="#inform">inform the user</a> that the
- focus is at the location given by the path. User agents may wait
- until the next time the <span>event loop</span> reaches its
- "update the rendering" step to optionally inform the user.</p>
+ focus is at the location given by the current default path. User
+ agents may wait until the next time the <span>event loop</span>
+ reaches its "update the rendering" step to optionally inform the
+ user.</p>
</li>
@@ -42629,7 +42665,7 @@
<li><p>Let <var title="">notional child</var> be a hypothetical
element that is a rendered child of the <code>canvas</code> element
whose dimensions are exactly the rectangle of the bounding box of
- the current path.</p></li>
+ the current default path.</p></li>
<li><p><span title="scroll an element into view">Scroll <var
title="">notional child</var> into view</span> with the <var
@@ -42661,9 +42697,9 @@
<p>The <dfn title="dom-context-2d-clip"><code>clip()</code></dfn>
method must create a new <dfn>clipping region</dfn> by calculating
the intersection of the current clipping region and the area
- described by the current path, using the non-zero winding number
- rule. Open subpaths must be implicitly closed when computing the
- clipping region, without affecting the actual subpaths. The new
+ described by the current default path, using the non-zero winding
+ number rule. Open subpaths must be implicitly closed when computing
+ the clipping region, without affecting the actual subpaths. The new
clipping region replaces the current clipping region.</p>
<p>When the context is initialized, the clipping region must be set
@@ -42689,11 +42725,11 @@
return true if the point given by the <var title="">x</var> and <var
title="">y</var> coordinates passed to the method, when treated as
coordinates in the canvas coordinate space unaffected by the current
- transformation, is inside the current path as determined by the
- non-zero winding number rule; and must return false
- otherwise. Points on the path itself are considered to be inside the
- path. If either of the arguments is infinite or NaN, then the method
- must return false.</p>
+ transformation, is inside the current default path as determined by
+ the non-zero winding number rule; and must return false otherwise.
+ Points on the path itself must be considered to be inside the path.
+ If either of the arguments is infinite or NaN, then the method must
+ return false.</p>
</div>
More information about the Commit-Watchers
mailing list