glenelkins Posted September 13, 2006 Share Posted September 13, 2006 HiHow 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[code]<?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);ImageEllipse($im,$middle_w,$middle_h,20,20,$white);ImageFill ($im,$middle_w,$middle_h,$white);ImageEllipse($im,$middle_w,$middle_h,30,30,$pink);ImageFill($im,$middle_w,$middle_h,$pink);ImagePNG($im);?>[/code] Quote Link to comment Share on other sites More sharing options...
Barand Posted September 13, 2006 Share Posted September 13, 2006 Use imagefilledellipse(). Draw backmost ellipse first, front ellipse last Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.