<!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>Creates a copy of the current path</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.copypage.html">CairoContext::copyPage</a></div> <div class="next" style="text-align: right; float: right;"><a href="cairocontext.copypathflat.html">CairoContext::copyPathFlat</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.copypath" class="refentry"> <div class="refnamediv"> <h1 class="refname">CairoContext::copyPath</h1> <h1 class="refname">cairo_copy_path</h1> <p class="verinfo">(PECL cairo >= 0.1.0)</p><p class="refpurpose"><span class="refname">CairoContext::copyPath</span> -- <span class="refname">cairo_copy_path</span> — <span class="dc-title">Creates a copy of the current path</span></p> </div> <div class="refsect1 description" id="refsect1-cairocontext.copypath-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"><a href="class.cairopath.html" class="type CairoPath">CairoPath</a></span> <span class="methodname"><strong>CairoContext::copyPath</strong></span> ( <span class="methodparam">void</span> )</div> <p class="para rdfs-comment">Procedural style:</p> <div class="methodsynopsis dc-description"> <span class="type"><a href="class.cairopath.html" class="type CairoPath">CairoPath</a></span> <span class="methodname"><strong>cairo_copy_path</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"> Creates a copy of the current path and returns it to the user as a <a href="class.cairopath.html" class="classname">CairoPath</a>. See <a href="class.cairopath.html" class="classname">CairoPath</a> for hints on how to iterate over the returned data structure. </p> <p class="para"> This function will always return a valid <a href="class.cairopath.html" class="classname">CairoPath</a> object, but the result will have no data, if either of the following conditions hold: <ul class="simplelist"> <li class="member">1. If there is insufficient memory to copy the path. In this case CairoPath->status will be set to CAIRO_STATUS_NO_MEMORY.</li> <li class="member">2. If <em><code class="parameter">context</code></em> is already in an error state. In this case CairoPath->status will contain the same status that would be returned by <span class="function"><a href="cairopattern.status.html" class="function">cairo_status()</a></span>.</li> </ul> In either case, CairoPath->status will be set to CAIRO_STATUS_NO_MEMORY (regardless of what the error status in cr might have been). </p> </div> <div class="refsect1 parameters" id="refsect1-cairocontext.copypath-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 <a href="class.cairocontext.html" class="classname">CairoContext</a> object created with <span class="methodname"><a href="cairocontext.construct.html" class="methodname">CairoContext::__construct()</a></span> or <span class="function"><a href="function.cairo-create.html" class="function">cairo_create()</a></span> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-cairocontext.copypath-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> A copy of the current <a href="class.cairopath.html" class="classname">CairoPath</a> in the context </p> </div> <div class="refsect1 examples" id="refsect1-cairocontext.copypath-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2865"> <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">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$context</span><span style="color: #007700">-></span><span style="color: #0000BB">copyPath</span><span style="color: #007700">())<br /><br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> object(CairoPath)#3 (0) { } </pre></div> </div> </div> </p> <p class="para"> <div class="example" id="example-2866"> <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">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">cairo_copy_path</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 class="example-contents"><p>The above example will output something similar to:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> object(CairoPath)#3 (0) { } </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-cairocontext.copypath-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="methodname"><a href="cairocontext.closepath.html" class="methodname" rel="rdfs-seeAlso">CairoContext::closePath()</a> - Closes the current path</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.copypage.html">CairoContext::copyPage</a></div> <div class="next" style="text-align: right; float: right;"><a href="cairocontext.copypathflat.html">CairoContext::copyPathFlat</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>