<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Establishes a new clip region from the current clip</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.clipextents.html">CairoContext::clipExtents</a></div> <div class="next" style="text-align: right; float: right;"><a href="cairocontext.cliprectanglelist.html">CairoContext::clipRectangleList</a></div> <div class="up"><a href="class.cairocontext.html">CairoContext</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="cairocontext.clippreserve" class="refentry"> <div class="refnamediv"> <h1 class="refname">CairoContext::clipPreserve</h1> <h1 class="refname">cairo_clip_preserve</h1> <p class="verinfo">(PECL cairo >= 0.1.0)</p><p class="refpurpose"><span class="refname">CairoContext::clipPreserve</span> -- <span class="refname">cairo_clip_preserve</span> — <span class="dc-title">Establishes a new clip region from the current clip</span></p> </div> <div class="refsect1 description" id="refsect1-cairocontext.clippreserve-description"> <h3 class="title">Description</h3> <p class="para">Object oriented style (method):</p> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>CairoContext::clipPreserve</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment">Procedural style:</p> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>cairo_clip_preserve</strong></span> ( <span class="methodparam"><span class="type"><a href="class.cairocontext.html" class="type CairoContext">CairoContext</a></span> <code class="parameter">$context</code></span> )</div> <p class="para rdfs-comment"> Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by <span class="methodname"><strong>Context.fill()</strong></span> and according to the current FILL RULE (see <span class="methodname"><a href="cairocontext.setfillrule.html" class="methodname">CairoContext::setFillRule()</a></span> or <span class="function"><a href="cairocontext.setfillrule.html" class="function">cairo_set_fill_rule()</a></span>). </p> <p class="para"> Unlike <span class="methodname"><a href="cairocontext.clip.html" class="methodname">CairoContext::clip()</a></span>, <span class="methodname"><strong>CairoContext::clipPreserve()</strong></span> preserves the path within the Context. The current clip region affects all drawing operations by effectively masking out any changes to the surface that are outside the current clip region. </p> <p class="para"> Calling <span class="methodname"><strong>CairoContext::clipPreserve()</strong></span> can only make the clip region smaller, never larger. But the current clip is part of the graphics state, so a temporary restriction of the clip region can be achieved by calling <span class="methodname"><strong>CairoContext::clipPreserve()</strong></span> within a <span class="methodname"><a href="cairocontext.save.html" class="methodname">CairoContext::save()</a></span>/ <span class="methodname"><a href="cairocontext.restore.html" class="methodname">CairoContext::restore()</a></span> pair. The only other means of increasing the size of the clip region is <span class="methodname"><a href="cairocontext.resetclip.html" class="methodname">CairoContext::resetClip()</a></span>. </p> </div> <div class="refsect1 parameters" id="refsect1-cairocontext.clippreserve-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">context</code></em></span> <dd> <p class="para"> A valid CairoContext object </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-cairocontext.clippreserve-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 examples" id="refsect1-cairocontext.clippreserve-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2856"> <p><strong>Example #1 Object oriented style</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$surface </span><span style="color: #007700">= new </span><span style="color: #0000BB">CairoImageSurface</span><span style="color: #007700">(</span><span style="color: #0000BB">CairoFormat</span><span style="color: #007700">::</span><span style="color: #0000BB">ARGB32</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$context </span><span style="color: #007700">= new </span><span style="color: #0000BB">CairoContext</span><span style="color: #007700">(</span><span style="color: #0000BB">$surface</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$context</span><span style="color: #007700">-></span><span style="color: #0000BB">clipPreserve</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> <p class="para"> <div class="example" id="example-2857"> <p><strong>Example #2 Procedural style</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /><br />$surface </span><span style="color: #007700">= </span><span style="color: #0000BB">cairo_image_surface_create</span><span style="color: #007700">(</span><span style="color: #0000BB">CAIRO_FORMAT_ARGB32</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">50</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$context </span><span style="color: #007700">= </span><span style="color: #0000BB">cairo_create</span><span style="color: #007700">(</span><span style="color: #0000BB">$surface</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cairo_clip_preserve</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-cairocontext.clippreserve-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="cairocontext.save.html" class="methodname" rel="rdfs-seeAlso">CairoContext::save()</a> - The save purpose</span></li> <li class="member"> <span class="methodname"><a href="cairocontext.restore.html" class="methodname" rel="rdfs-seeAlso">CairoContext::restore()</a> - The restore purpose</span></li> <li class="member"> <span class="methodname"><a href="cairocontext.resetclip.html" class="methodname" rel="rdfs-seeAlso">CairoContext::resetClip()</a> - The resetClip purpose</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.clipextents.html">CairoContext::clipExtents</a></div> <div class="next" style="text-align: right; float: right;"><a href="cairocontext.cliprectanglelist.html">CairoContext::clipRectangleList</a></div> <div class="up"><a href="class.cairocontext.html">CairoContext</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>