(PHP 4, PHP 5)
imagepolygon — Draws a polygon
imagepolygon() creates a polygon in the given image .
imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.
An array containing the polygon's vertices, e.g.:
points[0] | = x0 |
points[1] | = y0 |
points[2] | = x1 |
points[3] | = y1 |
Total number of points (vertices).
A color identifier created with 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);
?>
위 예제의 출력 예시: