php imagefilledpolygon,imagefilledpolygon()

imagefilledpolygon() 函数画一多边形并填充。

语法:

bool imagefilledpolygon( resource image, array points, int num_points, int color )

参数说明:

参数

说明

image

图像资源,欲绘制多边形的图像

points

按顺序包含有多边形各顶点的 x 和 y 坐标的数组

num_points

顶点的总数,必须大于 3

color

图像的颜色

绘制一个用红色填充的六边形例子:

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

$points = array(

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

100, 50, // Point 2 (x, y)

150, 100, // Point 3 (x, y)

150, 150, // Point 4 (x, y)

100, 150, // Point 5 (x, y)

50, 100 // Point 6 (x, y)

);

$im = imagecreatetruecolor(200, 200);

$red = imagecolorallocate($im, 255, 0, 0);

imagefilledpolygon($im, $points, 6, $red);

imagepng($im);

imagedestroy($im);

?>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值