The
GmagickDraw::polygon() function is an inbuilt function in PHP which is used to draw a polygon using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates.
Syntax:
GmagickDraw GmagickDraw::polygon( array $coordinates )
Parameters: This function accepts a single parameter
$coordinates which holds the coordinate array.
Return Value: This function returns GmagickDraw object on success.
Exceptions: This function throws GmagickDrawException on error.
Image Used:
👁 Image
Below examples illustrate the
GmagickDraw::polygon() function in PHP:
Example 1: Drawing over an image.
Output:
👁 Image
Example 2: Drawing from scratch.
Output:
👁 Image
Reference: https://www.php.net/manual/en/gmagickdraw.polygon.php