PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<imagesetpixelimagesetthickness>
Last updated: Mon, 16 Jul 2012

imagesetstyle

(PHP 4 >= 4.0.6, PHP 5)

imagesetstyle -- 设定画线的风格

说明

int imagesetstyle ( resource image, array style )

imagesetstyle() 设定所有画线的函数(例如 imageline()imagepolygon())在使用特殊颜色 IMG_COLOR_STYLED 或者用 IMG_COLOR_STYLEDBRUSHED 画一行图像时所使用的风格。

style 参数是像素组成的数组。下面的示例脚本在画布上从左上角到右下角画一行虚线:

例子 1. imagesetstyle() 例子

<?php
header
("Content-type: image/jpeg");
$im  = imagecreate(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);
?>

参见 imagesetbrush()imageline()

注: 本函数是 PHP 4.0.6 添加的。




<imagesetpixelimagesetthickness>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST