(PHP 4, PHP 5, PHP 7)
imagepolygon — 锟斤拷一锟斤拷锟斤拷锟斤拷锟�
$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() 锟斤拷锟斤拷
<?php
// 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() 锟斤拷 imagecreatetruecolor()锟斤拷