mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-28 23:08:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78672 c90b9560-bf6c-de11-be94-00142212c4b1
84 lines
2.7 KiB
XML
84 lines
2.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<!-- 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>imagesetstyle</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
header ("Content-type: image/png");
|
|
$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");
|
|
imagecolortransparent ($brush, $w);
|
|
imagesetbrush ($im, $brush);
|
|
imageline ($im, 100, 0, 0, 100, IMG_COLOR_STYLEDBRUSHED);
|
|
|
|
imagepng ($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
|
|
-->
|