HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
1158[Opera] Transformations affect path creation as well as stroking and filling.2008-01-15 07:44
@@ -13724,22 +13724,22 @@ interface <dfn>ImageData</dfn> {
   attribute must return the <code>canvas</code> element that the
   context paints on.</p>
 
 
   <h6>The canvas state</h6>
 
   <p>Each context maintains a stack of drawing states. <dfn
   title="drawing state">Drawing states</dfn> consist of:</p>
 
   <ul class="brief">
-   <li>The current transformation matrix.</li>
-   <li>The current clip region.</li>
+   <li>The current <span title="dom-context-2d-transformation">transformation matrix</span>.</li>
+   <li>The current <span>clipping path</span>.</li>
    <li>The current values of the following attributes: <code
    title="dom-context-2d-strokeStyle">strokeStyle</code>, <code
    title="dom-context-2d-fillStyle">fillStyle</code>, <code
    title="dom-context-2d-globalAlpha">globalAlpha</code>, <code
    title="dom-context-2d-lineWidth">lineWidth</code>, <code
    title="dom-context-2d-lineCap">lineCap</code>, <code
    title="dom-context-2d-lineJoin">lineJoin</code>, <code
    title="dom-context-2d-miterLimit">miterLimit</code>, <code
    title="dom-context-2d-shadowOffsetX">shadowOffsetX</code>, <code
    title="dom-context-2d-shadowOffsetY">shadowOffsetY</code>, <code
@@ -13759,26 +13759,25 @@ interface <dfn>ImageData</dfn> {
   method must push a copy of the current drawing state onto the
   drawing state stack.</p>
 
   <p>The <dfn
   title="dom-context-2d-restore"><code>restore()</code></dfn> method
   must pop the top entry in the drawing state stack, and reset the
   drawing state it describes. If there is no saved state, the method
   must do nothing.</p>
 
 
-  <h6><dfn>Transformations</dfn></h6>
+  <h6><dfn title="dom-context-2d-transformation">Transformations</dfn></h6>
 
-  <p>The transformation matrix is applied to all drawing operations
-  prior to their being rendered. It is also applied when creating the
-  clip region.</p> <!-- conformance criteria for actual drawing are
-  described in "drawing model" below -->
+  <p>The transformation matrix is applied to coordinates when creating
+  shapes and paths.</p> <!-- conformance criteria for actual drawing
+  are described in the various sections below -->
 
   <p>When the context is created, the transformation matrix must
   initially be the identity transform. It may then be adjusted using
   the transformation methods.</p>
 
   <p>The transformation matrix can become infinite, at which point
   nothing is drawn anymore.</p>
   <!--
    Philip Taylor wrote:
    > My experience with some 3d canvas code is that infinities come up in
@@ -14420,52 +14419,62 @@ notes on what would need to be defined for dashed lines:
   color, offset, and blur radius.</p>
 
   <!-- XXX we don't really define what that means -->
 
 
   <h6>Simple shapes (rectangles)</h6>
 
   <p>There are three methods that immediately draw rectangles to the
   bitmap. They each take four arguments; the first two give the <var
   title="">x</var> and <var title="">y</var> coordinates of the top
-  left of the rectangle, and the second two give the width and height
-  of the rectangle, respectively.</p>
+  left of the rectangle, and the second two give the width <var
+  title="">w</var> and height <var title="">h</var> of the rectangle,
+  respectively.</p>
+
+  <p>The <span title="dom-context-2d-transformation">current
+  transformation matrix</span> must be applied to the following four
+  coordinates, which form the path that must then be closed to get the
+  specified rectangle: <span>(<var title="">x</var>, <var
+  title="">y</var>)</span>, <span>(<span><var title="">x</var>+<var
+  title="">w</var></span>, <var title="">y</var>)</span>,
+  <span>(<span><var title="">x</var>+<var title="">w</var></span>,
+  <span><var title="">y</var>+<var title="">h</var></span>)</span>,
+  <span>(<var title="">x</var>, <span><var title="">y</var>+<var
+  title="">h</var></span>)</span>.</p>
 
   <p>Shapes are painted without affecting the current path, and are
-  subject to <span title="dom-context-2d-">transformations</span>,
-  <span title="shadows">shadow effects</span>, <span
-  title="globalAlpha">global alpha</span>, <span title="clipping
-  path">clipping paths</span>, and <span
-  title="globalCompositeOperation">global composition
+  subject to <span title="shadows">shadow effects</span>, <span
+  title="dom-context-2d-globalAlpha">global alpha</span>, <span
+  title="clipping path">clipping paths</span>, and <span
+  title="dom-context-2d-globalCompositeOperation">global composition
   operators</span>.</p>
 
   <p>Negative values for width and height must cause the
   implementation to raise an <code>INDEX_SIZE_ERR</code>
   exception.</p>
 
   <p>The <dfn
   title="dom-context-2d-clearRect"><code>clearRect()</code></dfn>
   method must clear the pixels in the specified rectangle to a fully
   transparent black, erasing any previous image. If either height or
   width are zero, this method has no effect.</p>
 
   <p>The <dfn
   title="dom-context-2d-fillRect"><code>fillRect()</code></dfn> method
   must paint the specified rectangular area using the <code
   title="dom-context-2d-fillStyle">fillStyle</code>. If either height
   or width are zero, this method has no effect.</p>
 
   <p>The <dfn
   title="dom-context-2d-strokeRect"><code>strokeRect()</code></dfn>
-  method must draw stroke the path that would be created for the
-  outline of a rectangle of the specified size using the <code
-  title="dom-context-2d-strokeStyle">strokeStyle</code>, <code
+  method must draw stroke the specified rectangle's path using the
+  <code title="dom-context-2d-strokeStyle">strokeStyle</code>, <code
   title="dom-context-2d-lineWidth">lineWidth</code>, <code
   title="dom-context-2d-lineJoin">lineJoin</code>, and (if
   appropriate) <code
   title="dom-context-2d-miterLimit">miterLimit</code> attributes. If
   both height and width are zero, this method has no effect, since
   there is no path to stroke (it's a point). If only one of the two is
   zero, then the method will draw a line instead (the path for the
   outline is just a straight line along the non-zero dimension).</p>
 
 
@@ -14478,20 +14487,26 @@ notes on what would need to be defined for dashed lines:
   <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>Initially, the context's path must have zero subpaths.</p>
 
+  <p>The coordinates given in the arguments to these methods must be
+  transformed according to the <span
+  title="dom-context-2d-transformation">current transformation
+  matrix</span> before applying the calculations described below and
+  before adding any points to the path.</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
@@ -14657,22 +14672,21 @@ notes on what would need to be defined for dashed lines:
 
   <p class="note">The transformation is applied to the path when it is
   drawn, not when the path is constructed. Thus, a single path can be
   constructed and then drawn according to different transformations
   without recreating the path.</p>
 
 
   <p>The <dfn title="dom-context-2d-clip"><code>clip()</code></dfn>
   method must create a new <dfn>clipping path</dfn> by calculating the
   intersection of the current clipping path and the area described by
-  the current path (after applying the <span>current
-  transformation</span>), using the non-zero winding number rule. Open
+  the current path, using the non-zero winding number rule. Open
   subpaths must be implicitly closed when computing the clipping path,
   without affecting the actual subpaths.</p>
 
   <p>When the context is created, the initial clipping path is the
   rectangle with the top left corner at (0,0) and the width and height
   of the coordinate space.</p>
 
   <!-- XXXv3
    Jordan OSETE suggests:
     * support ways of extending the clip region (union instead of intersection)
@@ -14735,29 +14749,30 @@ notes on what would need to be defined for dashed lines:
   object whose <code title="dom-attr-complete">complete</code>
   attribute is false, then the implementation must raise an
   <code>INVALID_STATE_ERR</code> exception.</p>
 
   <p>When <code title="dom-context-2d-drawImage">drawImage()</code> is
   invoked, the specified region of the image specified by the source
   rectangle (<var title="">sx</var>, <var title="">sy</var>, <var
   title="">sw</var>, <var title="">sh</var>) must be painted on the
   region of the canvas specified by the destination rectangle (<var
   title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>,
-  <var title="">dh</var>).</p>
+  <var title="">dh</var>), after applying the <span
+  title="dom-context-2d-transformation">current transformation
+  matrix</span>.</p>
 
   <p><img src="images/drawImage.png" alt=""></p> <!-- no alt="" text
   since the image is just repeating what was stated in the previous
   paragraph. -->
 
   <p>Images are painted without affecting the current path, and are
-  subject to <span>transformations</span>, <span
-  title="shadows">shadow effects</span>, <span
+  subject to <span title="shadows">shadow effects</span>, <span
   title="dom-context-2d-globalAlpha">global alpha</span>, <span
   title="clipping path">clipping paths</span>, and <span
   title="dom-context-2d-globalCompositeOperation">global composition
   operators</span>.</p>
 
   <!-- XXX should somehow say that the image used is the actual image
   of the target element, not the rendered image (e.g. height/width
   attributes don't affect it -->
 
 
@@ -14918,47 +14933,44 @@ notes on what would need to be defined for dashed lines:
   </div>
 
 
   <h6>Drawing model</h6>
 
   <p>When a shape or image is painted, user agents must follow these
   steps, in the order given (or act as if they do):</p>
 
   <ol>
 
-   <li>If the current transformation matrix is infinite, then do
-   nothing. Abort these steps.</li>
-
-   <li>The coordinates are transformed by the current transformation
-   matrix.</li>
-
    <li>The shape or image is rendered, creating image <var
    title="">A</var>, as described in the previous sections. For
-   shapes, the current fill, stroke, and line styles must be
-   honoured.</li>
+   shapes, the current fill, stroke, and line styles must be honoured,
+   and the stroke must itself also be subjected to the current
+   transformation matrix.</li>
 
    <li>The shadow is rendered from image <var title="">A</var>, using
    the current shadow styles, creating image <var
    title="">B</var>.</li>
 
    <li>Image <var title="">A</var> is composited over image <var
    title="">B</var> creating the source image.</li>
 
    <li>The source image has its alpha adjusted by <code
    title="dom-context-2d-globalAlpha">globalAlpha</code>.</li>
 
-   <li>Within the clip region (as affected by the current
-   transformation matrix), the source image is composited over the
-   current canvas bitmap using the current composition operator.</li>
+   <li>Within the clipping path, the source image is composited over
+   the current canvas bitmap using the current composition
+   operator.</li>
 
   </ol>
 
+  <!-- XXX add xrefs in the list above -->
+
 
 <!--
   <h5 id="3d">The 3D context</h5>
 
   <p class="big-issue">Well, one day.</p>
 -->
 
 
 
 

|