<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.imagesetstyle" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>imagesetstyle</refname>
  <refpurpose>Set the style for line drawing</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>imagesetstyle</methodname>
   <methodparam><type>GdImage</type><parameter>image</parameter></methodparam>
   <methodparam><type>array</type><parameter>style</parameter></methodparam>
  </methodsynopsis>
  <para>
   <function>imagesetstyle</function> sets the style to be used by all
   line drawing functions (such as <function>imageline</function>
   and <function>imagepolygon</function>) when drawing with the special
   color <constant>IMG_COLOR_STYLED</constant> or lines of images with color
   <constant>IMG_COLOR_STYLEDBRUSHED</constant>.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    &gd.image.description;
    <varlistentry>
     <term><parameter>style</parameter></term>
     <listitem>
      <para>
       An array of pixel colors. You can use the 
       <constant>IMG_COLOR_TRANSPARENT</constant> constant to add a 
       transparent pixel.
       Note that <parameter>style</parameter> must not be an empty <type>array</type>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   Following example script draws a dashed line from upper left to
   lower right corner of the canvas:
   <example>
    <title><function>imagesetstyle</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
header("Content-type: image/jpeg");
$im  = imagecreatetruecolor(100, 100);
$w   = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);

/* Draw a dashed line, 5 red pixels, 5 white pixels */
$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);
imagesetstyle($im, $style);
imageline($im, 0, 0, 100, 100, IMG_COLOR_STYLED);

/* Draw a line of happy faces using imagesetbrush() with imagesetstyle */
$style = array($w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $red);
imagesetstyle($im, $style);

$brush = imagecreatefrompng("http://www.libpng.org/pub/png/images/smile.happy.png");
$w2 = imagecolorallocate($brush, 255, 255, 255);
imagecolortransparent($brush, $w2);
imagesetbrush($im, $brush);
imageline($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);

imagejpeg($im);
imagedestroy($im);
?>
]]>
    </programlisting>
    &example.outputs.similar;
    <mediaobject>
     <alt>Output of example : imagesetstyle()</alt>
     <imageobject>
      <imagedata fileref="en/reference/image/figures/imagesetstyle.jpg"/>
     </imageobject>
    </mediaobject>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>imagesetbrush</function></member>
   <member><function>imageline</function></member>
  </simplelist>
 </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
