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

imagefilltoborder

(PHP 4, PHP 5, PHP 7)

imagefilltoborder - 填充到特定颜色

描述

代码语言:javascript
复制
bool imagefilltoborder ( resource $image , int $x , int $y , int $border , int $color )

imagefilltoborder()执行填充填充,其边框颜色由其定义border。的起点的填充物xy(左上为0,0),区域填充有颜色color

参数

代码语言:txt
复制
`image`   

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

x

开始的x坐标。

y

开始的y坐标。

border

边框颜色。使用imagecolorallocate()创建的颜色标识符。

color

填充颜??色。使用imagecolorallocate()创建的颜色标识符。

返回值

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

例子

Example #1 Filling an ellipse with a color

代码语言:javascript
复制
<?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 →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com