Skip to content

Commit

Permalink
[giow] (0) Add a way to reset the clipping region without affecting t…
Browse files Browse the repository at this point in the history
…he stack

Affected topics: Canvas

git-svn-id: http://svn.whatwg.org/webapps@7032 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 27, 2012
1 parent 4be18d9 commit 65c7899
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 89 deletions.
74 changes: 45 additions & 29 deletions complete.html
Expand Up @@ -34947,6 +34947,7 @@ <h5 id=2dcontext><span class=secno>4.8.11.1 </span>The 2D context</h5>
void <a href=#dom-context-2d-scrollpathintoview title=dom-context-2d-scrollPathIntoView>scrollPathIntoView</a>(<a href=#path>Path</a> path);
void <a href=#dom-context-2d-clip title=dom-context-2d-clip>clip</a>();
void <a href=#dom-context-2d-clip title=dom-context-2d-clip>clip</a>(<a href=#path>Path</a> path);
void <a href=#dom-context-2d-resetclip title=dom-context-2d-resetClip>resetClip</a>();
boolean <a href=#dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath>isPointInPath</a>(double x, double y);
boolean <a href=#dom-context-2d-ispointinpath title=dom-context-2d-isPointInPath>isPointInPath</a>(<a href=#path>Path</a> path, double x, double y);

Expand Down Expand Up @@ -37299,8 +37300,8 @@ <h6 id=drawing-rectangles-to-the-canvas><span class=secno>4.8.11.1.9 </span>Draw
<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 <a href=#current-default-path>current default
path</a>, 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
path</a>, and are subject to the <a href=#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>
Expand Down Expand Up @@ -37333,9 +37334,9 @@ <h6 id=drawing-rectangles-to-the-canvas><span class=secno>4.8.11.1.9 </span>Draw

<p>The <dfn id=dom-context-2d-clearrect title=dom-context-2d-clearRect><code>clearRect(<var title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var title="">h</var>)</code></dfn> method must run the following steps:</p>

<ol><li><p>Let <var title="">pixels</var> be the set of pixels in
the specified rectangle that also intersect the current clipping
region.</li>
<ol><li><p>Let <var title="">pixels</var> be the set of pixels in the
specified rectangle that also intersect the current <a href=#clipping-region>clipping
region</a>.</li>

<li><p>Clear the pixels in <var title="">pixels</var> to a fully
transparent black, erasing any previous image.</li>
Expand Down Expand Up @@ -37443,7 +37444,7 @@ <h6 id=drawing-text-to-the-canvas><span class=secno>4.8.11.1.10 </span>Drawing t
<p>These shapes are painted without affecting the current path,
and are 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
<a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>

</li>
Expand Down Expand Up @@ -37592,8 +37593,8 @@ <h6 id=drawing-text-to-the-canvas><span class=secno>4.8.11.1.10 </span>Drawing t

<p>Text is painted without affecting the current path, and is
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
title="dom-context-2d-globalAlpha">global alpha</span>, the
<span>clipping region</span>, and <span
title="dom-context-2d-globalCompositeOperation">global composition
operators</span>.</p>

Expand Down Expand Up @@ -37639,8 +37640,9 @@ <h6 id=drawing-text-to-the-canvas><span class=secno>4.8.11.1.10 </span>Drawing t
width). This version of the specification does not provide a way to
obtain the bounding box dimensions of the text. If the text is to be
rendered and removed, care needs to be taken to replace the entire
area of the canvas that the clipping region covers, not just the box
given by the em square height and measured text width.</p>
area of the canvas that the <a href=#clipping-region>clipping region</a> covers, not
just the box given by the em square height and measured text
width.</p>

</div>

Expand Down Expand Up @@ -37706,7 +37708,8 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing
<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
<a href=#current-default-path>current default path</a> or the given path and returns false.</p>
<a href=#current-default-path>current default path</a> or the given 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
Expand All @@ -37721,9 +37724,9 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing

<dd>

<p>Scrolls the <a href=#current-default-path>current default path</a> into view. This is especially
useful on devices with small screens, where the whole canvas might
not be visible at once.</p>
<p>Scrolls the <a href=#current-default-path>current default path</a> or the given path
into view. This is especially useful on devices with small
screens, where the whole canvas might not be visible at once.</p>

</dd>

Expand All @@ -37733,7 +37736,17 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing

<dd>

<p>Further constrains the clipping region to the <a href=#current-default-path>current default path</a>.</p>
<p>Further constrains the clipping region to the <a href=#current-default-path>current
default path</a> or the given path.</p>

</dd>


<dt><var title="">context</var> . <code title=dom-context-2d-resetClip><a href=#dom-context-2d-resetclip>resetClip</a></code>()</dt>

<dd>

<p>Unconstrains the clipping region.</p>

</dd>

Expand Down Expand Up @@ -37797,8 +37810,7 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing
the <a href=#current-default-path>current default path</a> or any <code><a href=#path>Path</a></code>
objects, 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
alpha</a>, the <a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>. (The effect of transformations is described above
and varies based on which path is being used.)</p>

Expand Down Expand Up @@ -37833,9 +37845,9 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing
<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>. (The
effect of transformations is described above and varies based on
which path is being used.)</p>
the <a href=#clipping-region>clipping region</a>. (The effect of transformations
is described above and varies based on which path is being
used.)</p>

</li>

Expand Down Expand Up @@ -37865,9 +37877,9 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing
<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>. (The
effect of transformations is described above and varies based on
which path is being used.)</p>
the <a href=#clipping-region>clipping region</a>. (The effect of transformations
is described above and varies based on which path is being
used.)</p>

</li>

Expand Down Expand Up @@ -37931,10 +37943,12 @@ <h6 id=drawing-paths-to-the-canvas><span class=secno>4.8.11.1.11 </span>Drawing
- also "add", "subtract", "replace", "intersect" and "xor"
- maybe just support creating unions, intersections, and other -ions of paths
-->
<!-- v5
Jordan OSETE suggests:
* support ways of resetting the clipping region without save/restore
-->

<p>The <dfn id=dom-context-2d-resetclip title=dom-context-2d-resetClip><code>resetClip()</code></dfn>
method must create a new <a href=#clipping-region>clipping region</a> that is the
rectangle with the top left corner at (0,0) and the width and height
of the coordinate space. The new clipping region replaces the
current clipping region.</p>

<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
Expand Down Expand Up @@ -38187,7 +38201,8 @@ <h6 id=drawing-images-to-the-canvas><span class=secno>4.8.11.1.12 </span>Drawing
<!-- createPattern() has an equivalent paragraph -->

<p>Images are painted without affecting the current path, and are
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
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>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operators</a>.</p>

<p>The <dfn id=dom-context-2d-imagesmoothingenabled title=dom-context-2d-imageSmoothingEnabled><code>imageSmoothingEnabled</code></dfn>
Expand Down Expand Up @@ -39068,7 +39083,8 @@ <h6 id=pixel-manipulation><span class=secno>4.8.11.1.14 </span><dfn>Pixel manipu
different values.</p>

<p>The current path, <a href=#transformations title=dom-context-2d-transformation>transformation matrix</a>,
<a href=#shadows title=shadows>shadow attributes</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
<a href=#shadows title=shadows>shadow attributes</a>, <a href=#dom-context-2d-globalalpha title=dom-context-2d-globalAlpha>global alpha</a>, the
<a href=#clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation title=dom-context-2d-globalCompositeOperation>global composition
operator</a> must not affect the <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData()</a></code> and <code title=dom-context-2d-putImageData><a href=#dom-context-2d-putimagedata>putImageData()</a></code>
methods.</p>

Expand Down

0 comments on commit 65c7899

Please sign in to comment.