Code for Drawing Complicated Circles
SLAVE CODE FOLLOWS
<?php // create a PNG image file
// create a blank image that is 200 pixels wide and 200 pixels tall
$image = imagecreate(200, 200);
// allocate some colors (all RGB HEX)
$yellow = imagecolorallocate($image, 0xFF, 0xFF, 0xAA);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);
// fill the entire image (i.e., background)
imagefilledrectangle($image, 0, 0, 400, 300, $yellow);
// create the 3D effect (stack oval arcs to create a pie chart)
// fill-arcs (image, x, y, arc-width, arc-height, start-angle, end-angle, color)
for ($i = 110; $i > 100; $i--)
{
imagefilledarc($image, 100, $i, 100, 50, 0, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 100, $i, 100, 50, 45, 75 , $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 100, $i, 100, 50, 75, 360 , $darkred, IMG_ARC_PIE);
}
// draw last oval-arc to cap the pie chart
imagefilledarc($image, 100, 100, 100, 50, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 100, 50, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 100, 50, 75, 360 , $red, IMG_ARC_PIE);
//=== display the image
// tell the server that a PNG image follows
header("Content-type: image/png");
// display the image
imagepng($image);
// destroy the image (i.e., release memory)
imagedestroy ($image);
?>