imagefilledrectangle

(PHP 3, PHP 4 , PHP 5)

imagefilledrectangle -- Draw a filled rectangle

Description

int imagefilledrectangle ( resource image, int x1, int y1, int x2, int y2, int color)

imagefilledrectangle() creates a filled rectangle of color color in image image starting at upper left coordinates x1, y1 and ending at bottom right coordinates x2, y2. 0, 0 is the top left corner of the image.

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
);

// create image
$im = imagecreate(250, 250);

// some colors
$bg   = imagecolorallocate($im, 255, 255, 255);
$blue = imagecolorallocate($im, 0, 0, 255);

// draw a polygon
imagefilledpolygon($im, $values, 6, $blue );

// flush image
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

?>