Vyfarbovanie plôch v GD.

<? 
$im = ImageCreate(301, 301); 
$bgc = ImageColorAllocate($im,255,255,255); 
$tc = ImageColorAllocate($im,0,0,0); 
$blue = ImageColorAllocate($im,60,155,236); 
$brown = ImageColorAllocate($im,198,108,0); 
$red = ImageColorAllocate($im,250,0,0); 
$yellow = ImageColorAllocate($im,250,250,0); 
 
ImageRectangle($im, 1, 100, 300, 300, $tc); 
ImageRectangle($im, 50, 150, 150, 250, $tc); 
ImageRectangle($im, 200, 150, 270, 300, $tc); 
ImageLine($im, 0, 100, 150, 0, $tc); 
ImageLine($im, 150, 0, 300, 100, $tc); 
 
//ImageFill(image, x, y, color); 
ImageFill($im, 150, 10, $red); 
ImageFill($im, 51, 151, $blue); 
ImageFill($im, 201, 151, $brown); 
ImageFill($im, 2, 101, $yellow); 
 
 
Header("Content-type: image/gif"); 
ImageGif($im); 
?>