11.09.2018 Views

Aprender a desarrollar un sitio Web con PHP y MySQL

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Las formas<br />

Las f<strong>un</strong>ciones de la librería GD dibujan formas como círculos, rectángulos, polígonos, etc.<br />

A <strong>con</strong>tinuación mostramos alg<strong>un</strong>as f<strong>un</strong>ciones <strong>con</strong> $recurso de <strong>un</strong>a imagen que se ha creado<br />

anteriormente:<br />

imagesetpixel($recurso, $x, $y, $color): píxel del color $color en las<br />

coordenadas $x,$y.<br />

imageline($recurso, $x1, $y1, $x2, $y2, $color): línea de<br />

color $colorentre las coordenadas $x1,$y1 y las coordenadas $x2,$y2.<br />

imagefill($recurso, $x, $y, $color): rectángulo desde las<br />

coordenadas $x,$yhasta el ángulo inferior derecho del recurso rellenado <strong>con</strong> el color $color.<br />

imagerectangle($recurso, $x1, $y1, $x2, $y2, $color): rectángulo de<br />

<strong>con</strong>torno que tiene el color $color entre las coordenadas $x1,$y1 y las<br />

coordenadas$x2,$y2.<br />

imagefilledrectangle($recurso, $x1, $y1, $x2, $y2, $color): rectángulo<br />

<strong>con</strong> el fondo que tiene el color $color entre las coordenadas $x1,$y1 y las<br />

coordenadas$x2,$y2.<br />

imageellipse($recurso, $x, $y, $ancho, $alto, $color): elipse <strong>con</strong><br />

coordenadas del centro $x y $y, de ancho $ancho, de alto $alto y el <strong>con</strong>torno <strong>con</strong> el<br />

color$color.<br />

imagefilledellipse($recurso,$x, $y, $ancho, $alto, $color): elipse <strong>con</strong><br />

coordenadas del centro $x y $y, de ancho $ancho, de alto $alto y cuyo fondo tiene el<br />

color$color.<br />

imagepolygon($recurso, $registro_p<strong>un</strong>tos, $numero_p<strong>un</strong>tos, $color):<br />

polígono <strong>con</strong> <strong>un</strong> número de p<strong>un</strong>tos igual a $numero_p<strong>un</strong>tos, donde las coordenadas de<br />

estos p<strong>un</strong>tos se ubican en el registro $registro_p<strong>un</strong>tos y cuyo <strong>con</strong>torno tiene el<br />

color$color.<br />

imageflip($recurso, $modo): devuelve la imagen <strong>con</strong> el modo suministrado. Los<br />

valores del modo son:<br />

IMG_FLIP_HORIZONTAL: devuelve la imagen horizontalmente.<br />

IMG_FLIP_VERTICAL: devuelve la imagen verticalmente.<br />

IMG_FLIP_BOTH: devuelve la imagen horizontal y verticalmente.<br />

Esta f<strong>un</strong>ción sólo existe desde <strong>PHP</strong> 5.5.<br />

Por ejemplo:<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!