note 51730 deleted from function.imagefilledarc by tularis

From: Date: Sat, 05 Jul 2008 09:58:59 +0000
Subject: note 51730 deleted from function.imagefilledarc by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141190@lists.php.net to get a copy of this message
Note Submitter: double-zonk at wp dot pl ---- <? $width = 300; $height = 200; $dane[] = 1; $dane[] = 2; $dane[] = 3; $dane[] = 4; $dane[] = 5; $dane[] = 6; $dane[] = 7; $dane[] = 8; $dane[] = 9; $dane[] = 10; $dane[] = 11; // Kolory $image = imageCreate($width, $height); $background = imageColorAllocate($image, 205, 205, 205); $kolor[0] = imageColorAllocate($image, 255, 203, 3); $kolor[1] = imageColorAllocate($image, 220, 101, 29); $kolor[2] = imageColorAllocate($image, 189, 24, 51); $kolor[3] = imageColorAllocate($image, 214, 0, 127); $kolor[4] = imageColorAllocate($image, 98, 1, 96); $kolor[5] = imageColorAllocate($image, 0, 62, 136); $kolor[6] = imageColorAllocate($image, 0, 102, 179); $kolor[7] = imageColorAllocate($image, 0, 145, 195); $kolor[8] = imageColorAllocate($image, 0, 115, 106); $kolor[9] = imageColorAllocate($image, 178, 210, 52); $kolor[10] = imageColorAllocate($image, 137, 91, 74); $kolor[11] = imageColorAllocate($image, 82, 56, 47); $cien[0] = imagecolorallocate($image, 205, 153, 0); $cien[1] = imagecolorallocate($image, 170, 51, 0); $cien[2] = imagecolorallocate($image, 139, 0, 1); $cien[3] = imagecolorallocate($image, 164, 0, 77); $cien[4] = imagecolorallocate($image, 48, 0, 46); $cien[5] = imagecolorallocate($image, 0, 12, 86); $cien[6] = imagecolorallocate($image, 0, 52, 129); $cien[7] = imagecolorallocate($image, 0, 95, 145); $cien[8] = imagecolorallocate($image, 0, 65, 56); $cien[9] = imagecolorallocate($image, 128, 160, 2); $cien[10] = imagecolorallocate($image, 87, 41, 24); $cien[11] = imagecolorallocate($image, 32, 6, 0); // Oblicznia $suma = array_sum($dane); $stopnie = 0; for($i = 0; $i < count($dane); $i++){ $start[$i]= $stopnie; $stop[$i] = $stopnie + round(($dane[$i] / $suma) * 360, 0); $stopnie = $stop[$i]; } $x = $width / 2; $size = $width / 10; $y = $height / 2 - $size / 2 - 1; // Wyswietlanie for($g = $size; $g > 0; $g--){ for($n = 0; $n < count($dane); $n++){ imagefilledarc($image, $x, $y+$g, $width, $height - $size, $start[$n], $stop[$n], $cien[$n], IMG_ARC_PIE); } } for($i = 0; $i < count($dane); $i++){ imagefilledarc($image, $x, $y, $width, $height - $size, $start[$i], $stop[$i], $kolor[$i], IMG_ARC_PIE); } header("Content-type: image/png"); imagePNG($image); imageDestroy($image); ?>

« previous php.notes (#141190) next »