imagefilltoborder
(PHP 4, PHP 5, PHP 7)
imagefilltoborder - 填充到特定颜色
描述
bool imagefilltoborder ( resource $image , int $x , int $y , int $border , int $color )
imagefilltoborder()执行填充填充,其边框颜色由其定义border
。的起点的填充物x
,y
(左上为0,0),区域填充有颜色color
。
参数
`image`
一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。
x
开始的x坐标。
y
开始的y坐标。
border
边框颜色。使用imagecolorallocate()创建的颜色标识符。
color
填充颜??色。使用imagecolorallocate()创建的颜色标识符。
返回值
返回TRUE
成功或失败时返回FALSE
。
例子
Example #1 Filling an ellipse with a color
<?php
//?Create?the?image?handle,?set?the?background?to?white
$im?=?imagecreatetruecolor(100,?100);
imagefilledrectangle($im,?0,?0,?100,?100,?imagecolorallocate($im,?255,?255,?255));
//?Draw?an?ellipse?to?fill?with?a?black?border
imageellipse($im,?50,?50,?50,?50,?imagecolorallocate($im,?0,?0,?0));
//?Set?the?border?and?fill?colors
$border?=?imagecolorallocate($im,?0,?0,?0);
$fill?=?imagecolorallocate($im,?255,?0,?0);
//?Fill?the?selection
imagefilltoborder($im,?50,?50,?$border,?$fill);
//?Output?and?free?memory
header('Content-type:?image/png');
imagepng($im);
imagedestroy($im);
?>
上面的例子会输出类似于:
← imagefilledrectangle
imagefilter →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com