<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.image.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.imagesetbrush.php',
    1 => 'imagesetbrush',
    2 => '为线条设置笔刷图像',
  ),
  'up' => 
  array (
    0 => 'ref.image.php',
    1 => 'GD 和图像处理 函数',
  ),
  'prev' => 
  array (
    0 => 'function.imagescale.php',
    1 => 'imagescale',
  ),
  'next' => 
  array (
    0 => 'function.imagesetclip.php',
    1 => 'imagesetclip',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/image/functions/imagesetbrush.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.imagesetbrush" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">imagesetbrush</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">imagesetbrush</span> &mdash; <span class="dc-title">为线条设置笔刷图像</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.imagesetbrush-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>imagesetbrush</strong></span>(<span class="methodparam"><span class="type"><a href="class.gdimage.php" class="type GdImage">GdImage</a></span> <code class="parameter">$image</code></span>, <span class="methodparam"><span class="type"><a href="class.gdimage.php" class="type GdImage">GdImage</a></span> <code class="parameter">$brush</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   当用特殊的颜色 <code class="literal">IMG_COLOR_BRUSHED</code> 或 <code class="literal">IMG_COLOR_STYLEDBRUSHED</code>
   绘制时，<span class="function"><strong>imagesetbrush()</strong></span> 通过所有的线条函数设置要使用的笔刷图像。【注：使用笔刷图像，所画的线是由
   <code class="parameter">brush</code> 所代表的图像构成的。请参考并尝试运行
   <span class="function"><a href="function.imagesetstyle.php" class="function">imagesetstyle()</a></span> 中的例子以帮助理解。】

  </p>
  <div class="caution"><strong class="caution">警告</strong>
   <p class="para">
    笔刷完成后不需要采取什么特殊动作，但如果要销毁笔刷图像（或让 PHP 销毁），不能使用 <strong><code><a href="image.constants.php#constant.img-color-brushed">IMG_COLOR_BRUSHED</a></code></strong>
    或 <strong><code><a href="image.constants.php#constant.img-color-styledbrushed">IMG_COLOR_STYLEDBRUSHED</a></code></strong> 颜色，除非设置了新的笔刷图像。
   </p>
  </div>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.imagesetbrush-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    <dt>
<code class="parameter">image</code></dt><dd><p class="para">由图象创建函数(例如<span class="function"><a href="function.imagecreatetruecolor.php" class="function">imagecreatetruecolor()</a></span>)返回的 
<span class="classname"><a href="class.gdimage.php" class="classname">GdImage</a></span> 对象。</p></dd>
    
     <dt><code class="parameter">brush</code></dt>
     <dd>
      <p class="para">
       图像对象。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.imagesetbrush-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   总是返回 <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.imagesetbrush-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">image</code> 和 <code class="parameter">brush</code> 现在需要
       <span class="classname"><a href="class.gdimage.php" class="classname">GdImage</a></span> 实例，之前需要 <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.imagesetbrush-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>imagesetbrush()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// 加载迷你 php logo<br /></span><span style="color: #0000BB">$php </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatefrompng</span><span style="color: #007700">(</span><span style="color: #DD0000">'./php.png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 创建主图像 100x100<br /></span><span style="color: #0000BB">$im </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecreatetruecolor</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">, </span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 用白色填充背景<br /></span><span style="color: #0000BB">$white </span><span style="color: #007700">= </span><span style="color: #0000BB">imagecolorallocate</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">, </span><span style="color: #0000BB">255</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">imagefilledrectangle</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">299</span><span style="color: #007700">, </span><span style="color: #0000BB">99</span><span style="color: #007700">, </span><span style="color: #0000BB">$white</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 设置画笔<br /></span><span style="color: #0000BB">imagesetbrush</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">, </span><span style="color: #0000BB">$php</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 画几支画笔，每支都相互重叠<br /></span><span style="color: #0000BB">imageline</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</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">, </span><span style="color: #0000BB">50</span><span style="color: #007700">, </span><span style="color: #0000BB">60</span><span style="color: #007700">, </span><span style="color: #0000BB">IMG_COLOR_BRUSHED</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 输出图像到浏览器<br /></span><span style="color: #0000BB">header</span><span style="color: #007700">(</span><span style="color: #DD0000">'Content-type: image/png'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">imagepng</span><span style="color: #007700">(</span><span style="color: #0000BB">$im</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="mediaobject">
     
     <div class="imageobject">
      <img src="images/21009b70229598c6a80eef8b45bf282b-imagesetbrush.png" alt="Output of example : imagesetbrush()" width="100" height="100" />
     </div>
    </div>
   </div>
  </p>
 </div>


</div><?php manual_footer($setup); ?>