imagefilledpolygon
(PHP 3, PHP 4, PHP 5)
imagefilledpolygon -- Dibuja un polígono relleno
Descripción
bool
imagefilledpolygon ( resource im, array points, int num_points, int col )
imagefilledpolygon() crea un polígono relleno en la
imagen im.
points es una matriz conteniendo los vértices
x e y del polígono, por ejemplo:
points[0] = x0, points[1] = y0, points[2] = x1, points[3] = y1, etc.
num_points es el número total de vértices,
que debe ser mayor que 3.
Ejemplo 1. Ejemplo de imagefilledpolygon()
<?php // Crear la matriz de los verices del poligono $values = array( 40, 50, // Point 1 (x, y) 20, 240, // Point 2 (x, y) 60, 60, // Point 3 (x, y) 240, 20, // Point 4 (x, y) 50, 40, // Point 5 (x, y) 10, 10 // Point 6 (x, y) );
// crear la imagen $image = imagecreate(250, 250);
// preparar los colores $bg = imagecolorallocate($image, 200, 200, 200); $blue = imagecolorallocate($image, 0, 0, 255);
// dibujar el poligono imagefilledpolygon($image, $values, 6, $blue);
// mostrar la imagen header('Content-type: image/png'); imagepng($image); imagedestroy($image); ?>
|
|