imagefilledpolygon
(PHP 3, PHP 4 , PHP 5)
imagefilledpolygon -- Dessine un polygone rempli
Description
int
imagefilledpolygon ( resource image, array points, int num_points, int color)
imagefilledpolygon() dessine un polygone rempli dans l'image
image. points est un tableau PHP qui
contient les sommets des polygones sous la forme :. points[0] = x0,
points[1] = y0, points[2] = x1, points[3] = y1, etc. num_points
est le nombre total de sommets.
Exemple 1. Exemple avec imagefilledpolygon()
<?php
// Cette exemple nous est proposé par ecofarm@mullum.com.au
// Création d'un tableau de points pour le polygone $values = array( 0 => 40, // x1 1 => 50, // y1 2 => 20, // x2 3 => 240, // y2 4 => 60, // x3 5 => 60, // y3 6 => 240, // x4 7 => 20, // y4 8 => 50, // x5 9 => 40, // y5 10 => 10, // x6 11 => 10, // y6 );
// Création de l'image $im = imagecreate(250, 250);
// Quelques couleurs $bg = imagecolorallocate($im, 255, 255, 255); $blue = imagecolorallocate($im, 0, 0, 255);
// Dessine un polygone imagefilledpolygon($im, $values, 6, $blue );
// Affichage de l'image header('Content-type: image/png'); imagepng($im); imagedestroy($im);
?>
|
|