php多边图形,画一个多边形 - PHP 7 中文文档

(PHP 4, PHP 5, PHP 7)

imagepolygon – 画一个多边形

说明

imagepolygon

( resource $image

, array $points

, int $num_points

, int $color

) : bool

imagepolygon() 在图像中创建一个多边形。points

是一个 PHP 数组,包含了多边形的各个顶点坐标,即 points[0]

= x0,points[1] = y0,points[2]

= x1,points[3] = y1,以此类推。num_points

是顶点的总数。

Example #1 imagepolygon() 例子

// create a blank image

$image = imagecreatetruecolor(400, 300);

// fill the background color

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

// choose a color for the polygon

$col_poly = imagecolorallocate($image, 255, 255, 255);

// draw the polygon

imagepolygon($image,

array (

0, 0,

100, 200,

300, 200

),

3,

$col_poly);

// output the picture

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

imagepng($image);

?>

参见 [imagecreate()](php7/function.imagecreate) 和

[imagecreatetruecolor()](php7/function.imagecreatetruecolor)。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值