Jump to content


This topic is now archived and is closed to further replies.


Multiple Shapes On One Canvas - GD Library

Recommended Posts


How can i draw multiple shapes on the same canvas, with different fills? The following code i wanted to display the first ellipse as filled with white, the second around the back of the first one in pink, so it looks like the first one has a thick pink border, then i will want to add another one slightly bigger in a different colour..At the moment it seems to display the whole lot filled with pink, but only the outter ellipse is not filled only a pink outline. See what i mean at: http://www.gewebsitedevelopment.com/gd2.php


header ("Content-type: image/png");

// Second box - ellipse
$height = 400;
$width = 400;
$middle_h = $height / 2;
$middle_w = $width / 2;

$im = ImageCreate($width,$height);

$bck = ImageColorAllocate($im,0,0,0);
$white = ImageColorAllocate($im,255,255,255);
$pink = ImageColorAllocate($im,217,171,161);

ImageFill ($im,$middle_w,$middle_h,$white);



Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.