|
imagefilledpolygon (PHP 3, PHP 4 ) imagefilledpolygon -- 画一多边形并填充 说明int imagefilledpolygon ( resource image, array points, int num_points, int color)
imagefilledpolygon() 在 image
图像中画一个填充了的多边形。points
是一个 PHP 的数组,包含了多边形的各个顶点坐标,即 points[0]
= x0,points[1] = y0,points[2]
= x1,points[3] = y1,以此类推。num_points 是顶点的总数。
例子 1. imagefilledpolygon() 例子
<?php
// this example is provided by ecofarm at mullum dot com dot au
// set up array of points for polygon $values = array( 0 => 40, // x1 1 => 50, // y1 2 => 20, // x2 3 => 240, // y2 4 => 60, // x3 5 => 60, // y3 6 => 240, // x4 7 => 20, // y4 8 => 50, // x5 9 => 40, // y5 10 => 10, // x6 11 => 10, // y6 );
// create image $im = imagecreate(250, 250);
// some colors $bg = imagecolorallocate($im, 255, 255, 255); $blue = imagecolorallocate($im, 0, 0, 255);
// draw a polygon imagefilledpolygon($im, $values, 6, $blue );
// flush image header('Content-type: image/png'); imagepng($im); imagedestroy($im);
?>
|
|
| |