php使用 imagepolygon()方法画图
php使用 imagepolygon()方法画图 [代码片段(27行)]
$points array accepted by the imagepolygon() function is of the following format
<?php
define('WIDTH', 100);
define('HEIGHT', 100);
$img = imagecreate(WIDTH, HEIGHT);
$white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
$black = Imagecolorallocate($img, 0, 0, 0);
$points = array(0, 0, // Vertex (0,0)
0, HEIGHT, // Vertex (0, HEIGHT)
(int)WIDTH/2, 0, // Vertex (WIDTH/2, 0)
WIDTH-1, HEIGHT-1, // Vertex (WIDTH, HEIGHT)
WIDTH-1, 0); // Vertex (WIDTH, 0)
imagepolygon($img, $points, 5, $black);
header('Content-type: image/png');
imagepng($img);
?>
精彩图集
精彩文章






