php-doc-en/reference/image/functions/imagesetstyle.xml
Gabor Hojtsy 634c212476 Fix example, so it will display properly. Also modify
example title...


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@108886 c90b9560-bf6c-de11-be94-00142212c4b1
2002-12-22 19:46:02 +00:00

85 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.43 -->
<refentry id="function.imagesetstyle">
<refnamediv>
<refname>imagesetstyle</refname>
<refpurpose>Set the style for line drawing</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>imagesetstyle</methodname>
<methodparam><type>resource</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 <literal>IMG_COLOR_STYLED</literal> or lines of images with color
<literal>IMG_COLOR_STYLEDBRUSHED</literal>.
</para>
<para>
The <parameter>style</parameter> parameter is an array of pixels.
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 = imagecreate (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>
</para>
<para>
See also <function>imagesetbrush</function>, <function>imageline</function>.
</para>
<note><para>This function was added in PHP 4.0.6</para></note>
</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:"../../../../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
-->