首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagesetbrush

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

imagesetbrush - 为画线设置画笔图像

描述

代码语言:javascript
复制
bool imagesetbrush ( resource $image , resource $brush )

imagesetbrush()设置刷子图像由所有画线功能一起使用(如imageline()和imagepolygon())与特殊颜色绘制时IMG_COLOR_BRUSHEDIMG_COLOR_STYLEDBRUSHED

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

brush

一个图像资源。

返回值

返回TRUE成功或失败时返回FALSE

例子

Example #1 imagesetbrush() example

代码语言:javascript
复制
<?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_BRUSHEDIMG_COLOR_STYLEDBRUSHED颜色,直到您设置了新的笔刷图像!

← imagescale

imagesetclip →

扫码关注腾讯云开发者

领取腾讯云代金券