imagepolygon
(PHP 4, PHP 5, PHP 7)
imagepolygon - 绘制一个多边形
描述
bool imagepolygon ( resource $image , array $points , int $num_points , int $color )
imagepolygon()在给定中创建一个多边形image
。
参数
`image`
一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。
points
包含多边形顶点的数组,例如:
points0 | = x0 |
---|---|
points1 | = y0 |
points2 | = x1 |
points3 | = y1 |
num_points
点(顶点)的总数。
color
使用imagecolorallocate()创建的颜色标识符。
返回值
返回TRUE
成功或失败时返回FALSE
。
例子
Example #1 imagepolygon() example
<?php
//?Create?a?blank?image
$image?=?imagecreatetruecolor(400,?300);
//?Allocate?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?to?the?browser
header('Content-type:?image/png');
imagepng($image);
imagedestroy($image);
?>
上面的例子会输出类似于:
← imagepng
imagepsbbox →
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com