PHP/Graphics Image/imagefilledpolygon

Материал из Web эксперт
Перейти к: навигация, поиск

Complex Shapes

   <source lang="html4strict">

<?

   $points = array(
           20, // x1, top-left
           20, // y1
           230, // x2, top-right
           20, // y2
           230, // x3, bottom-right
           230, // y3
           20, // x4, bottom-left
           230 // y4
   );
   $image = imagecreatetruecolor(250, 250);
   $green = imagecolorallocate($image, 0, 255, 0);
   imagefilledpolygon($image, $points, 4, $green );
   header("Content-type: image/png");
   imagepng($image);
   imagedestroy($image);

?>

 </source>
   
  


Drawing a Polygon with imagefilledpolygon()

   <source lang="html4strict">

<?php header("Content-type: image/png"); $image = imagecreate( 200, 200 ); $red = imagecolorallocate($image, 255,0,0); $blue = imagecolorallocate($image, 0,0,255 ); $points = array ( 10, 10,

     190, 190,
     190, 10,
     10, 190
     );

imagefilledpolygon( $image, $points, count( $points )/2 , $blue ); imagepng($image); ?>

 </source>