imagesetstyle

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

imagesetstyle — �趨���ߵķ��

˵��

imagesetstyle ( resource $image , array $style ) : bool

imagesetstyle() �趨���л��ߵĺ��������� imageline() �� imagepolygon()����ʹ��������ɫ IMG_COLOR_STYLED ������ IMG_COLOR_STYLEDBRUSHED ��һ��ͼ��ʱ��ʹ�õķ��

����

image

��ͼ�󴴽�����(����imagecreatetruecolor())���ص�ͼ����Դ��

style

������ɵ����顣�����ͨ������ IMG_COLOR_TRANSPARENT �����һ��͸�����ء�

����ֵ

�ɹ�ʱ���� TRUE�� ������ʧ��ʱ���� FALSE��

����

�����ʾ���ű��ڻ����ϴ����Ͻǵ����½ǻ�һ�����ߣ�

Example #1 imagesetstyle() ����

<?php
header
("Content-type: image/jpeg");
$im  = imagecreatetruecolor(100, 100);
$w   = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);

/* ��һ�����ߣ�5 ����ɫ���أ�5 ����ɫ���� */
$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);
imagesetstyle($im, $style);
imageline($im, 0, 0, 100, 100, IMG_COLOR_STYLED);

/* �� imagesetbrush() �� 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);
?>

�������̵���������ڣ�

Output of example : imagesetstyle()

�μ�