imagepolygon() फंक्शन का उपयोग पॉलीगॉन ड्रॉ करने के लिए किया जाता है।
सिंटैक्स
bool imagepolygon( $img, $points, $num_points, $color)
पैरामीटर्स
- $img: imagecreatetruecolor() फंक्शन के साथ ब्लैंक इमेज बनाएं।
- $points: पॉलीगॉन के वर्टेक्स के साथ ऐरे।
- $num_points: पॉलीगॉन में वर्टेक्स की कुल संख्या।
- $color: imagecolorallocate() फंक्शन के साथ बनाया गया कलर आइडेंटिफायर।
रिटर्न
imagepolygon() फंक्शन सफलता पर TRUE या विफलता पर FALSE लौटाता है।
उदाहरण
निम्नलिखित एक उदाहरण है:
<?php
$img = imagecreatetruecolor(400, 300);
$color = imagecolorallocate($img, 120, 160, 190);
$bgcolor = imagecolorallocate($img, 10, 100, 50);
imagefill($img, 0, 0, $bgcolor);
imagepolygon($img, array(
50, 50,
150, 200,
340, 200
),
3,
$color);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
आउटपुट
निम्नलिखित आउटपुट है:
