imagesetbrush
(PHP 4 >= 4.0.6, PHP 5, PHP 7)
imagesetbrush - 为画线设置画笔图像
描述
bool imagesetbrush ( resource $image , resource $brush )
imagesetbrush()设置刷子图像由所有画线功能一起使用(如imageline()和imagepolygon())与特殊颜色绘制时IMG_COLOR_BRUSHED
或IMG_COLOR_STYLEDBRUSHED
。
参数
`image`
一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。
brush
一个图像资源。
返回值
返回TRUE
成功或失败时返回FALSE
。
例子
Example #1 imagesetbrush() example
<?php
// Load a mini php logo
$php = imagecreatefrompng('./php.png');
// Create the main image, 100x100
$im = imagecreatetruecolor(100, 100);
// Fill the background with white
$white = imagecolorallocate($im, 255, 255, 255);
imagefilledrectangle($im, 0, 0, 299, 99, $white);
// Set the brush
imagesetbrush($im, $php);
// Draw a couple of brushes, each overlaying each
imageline($im, 50, 50, 50, 60, IMG_COLOR_BRUSHED);
// Output image to the browser
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
imagedestroy($php);
?>
上面的例子会输出类似于:

注释
注意:使用笔刷时,不需要执行特殊操作,但是如果您销毁笔刷图像,则必须先使用
IMG_COLOR_BRUSHED
或IMG_COLOR_STYLEDBRUSHED
颜色,直到您设置了新的笔刷图像!
← imagescale
imagesetclip →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com