php7支持画,画一多边形并填充 - PHP 7 中文文档

(PHP 4, PHP 5, PHP 7)

imagefilledpolygon – 画一多边形并填充

说明

imagefilledpolygon

( resource $image

, array $points

, int $num_points

, int $color

) : bool

imagefilledpolygon() 在 image

图像中画一个填充了的多边形。

points 参数是一个按顺序包含有多边形各顶点的

x 和 y

坐标的数组。

num_points 参数是顶点的总数,必须大于 3。

Example #1 imagefilledpolygon() 例子

// 建立多边形各顶点坐标的数组

$values = array(

40, 50, // Point 1 (x, y)

20, 240, // Point 2 (x, y)

60, 60, // Point 3 (x, y)

240, 20, // Point 4 (x, y)

50, 40, // Point 5 (x, y)

10, 10 // Point 6 (x, y)

);

// 创建图像

$image = imagecreatetruecolor(250, 250);

// 设定颜色

$bg = imagecolorallocate($image, 200, 200, 200);

$blue = imagecolorallocate($image, 0, 0, 255);

// 画一个多边形

imagefilledpolygon($image, $values, 6, $blue);

// 输出图像

header('Content-type: image/png');

imagepng($image);

imagedestroy($image);

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值