(PHP 7 >= 7.2.0)
imageopenpolygon — Dessine un polygone ouvert
$image
, array $points
, int $num_points
, int $color
) : bool
imageopenpolygon() dessine un polygone ouvert sur
l'image
. Contrairement à imagepolygon(),
aucune ligne est dessiné entre le dernier et le premier point.
image
Une ressource d'image, retournée par une des fonctions de création d'images, comme imagecreatetruecolor().
points
Un tableau contenant les sommets du polygone, par exemple :
points[0] | = x0 |
points[1] | = y0 |
points[2] | = x1 |
points[3] | = y1 |
num_points
Nombre total de points (sommets).
color
Un identificateur de couleur créé avec imagecolorallocate().
Cette fonction retourne TRUE
en cas de succès ou FALSE
si une erreur survient.
Exemple #1 Exemple avec imageopenpolygon()
<?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
imageopenpolygon($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);
?>
L'exemple ci-dessus va afficher quelque chose de similaire à :