| @@ 333-360 (lines=28) @@ | ||
| 330 | exit(0); |
|
| 331 | } |
|
| 332 | ||
| 333 | function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text='', $placeindex=0) |
|
| 334 | { |
|
| 335 | $r=$diameter/2; |
|
| 336 | $w=deg2rad((360+$start+($end-$start)/2)%360); |
|
| 337 | ||
| 338 | ||
| 339 | if (function_exists("imagefilledarc")) { |
|
| 340 | // exists only if GD 2.0.1 is avaliable |
|
| 341 | imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE); |
|
| 342 | imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE); |
|
| 343 | imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); |
|
| 344 | } else { |
|
| 345 | imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2); |
|
| 346 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
| 347 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
| 348 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
| 349 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
| 350 | imagefill($im, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2); |
|
| 351 | } |
|
| 352 | if ($text) { |
|
| 353 | if ($placeindex>0) { |
|
| 354 | imageline($im, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $diameter, $placeindex*12, $color1); |
|
| 355 | imagestring($im, 4, $diameter, $placeindex*12, $text, $color1); |
|
| 356 | } else { |
|
| 357 | imagestring($im, 4, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $text, $color1); |
|
| 358 | } |
|
| 359 | } |
|
| 360 | } |
|
| 361 | ||
| 362 | function text_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $text, $placeindex=0) |
|
| 363 | { |
|
| @@ 621-648 (lines=28) @@ | ||
| 618 | } |
|
| 619 | ||
| 620 | ||
| 621 | function fill_arc($im, $centerX, $centerY, $diameter, $start, $end, $color1, $color2, $text='', $placeindex=0) |
|
| 622 | { |
|
| 623 | $r=$diameter/2; |
|
| 624 | $w=deg2rad((360+$start+($end-$start)/2)%360); |
|
| 625 | ||
| 626 | ||
| 627 | if (function_exists("imagefilledarc")) { |
|
| 628 | // exists only if GD 2.0.1 is avaliable |
|
| 629 | imagefilledarc($im, $centerX+1, $centerY+1, $diameter, $diameter, $start, $end, $color1, IMG_ARC_PIE); |
|
| 630 | imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2, IMG_ARC_PIE); |
|
| 631 | imagefilledarc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color1, IMG_ARC_NOFILL|IMG_ARC_EDGED); |
|
| 632 | } else { |
|
| 633 | imagearc($im, $centerX, $centerY, $diameter, $diameter, $start, $end, $color2); |
|
| 634 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
| 635 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($start+1)) * $r, $centerY + sin(deg2rad($start)) * $r, $color2); |
|
| 636 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end-1)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
| 637 | imageline($im, $centerX, $centerY, $centerX + cos(deg2rad($end)) * $r, $centerY + sin(deg2rad($end)) * $r, $color2); |
|
| 638 | imagefill($im, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $color2); |
|
| 639 | } |
|
| 640 | if ($text) { |
|
| 641 | if ($placeindex>0) { |
|
| 642 | imageline($im, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $diameter, $placeindex*12, $color1); |
|
| 643 | imagestring($im, 4, $diameter, $placeindex*12, $text, $color1); |
|
| 644 | } else { |
|
| 645 | imagestring($im, 4, $centerX + $r*cos($w)/2, $centerY + $r*sin($w)/2, $text, $color1); |
|
| 646 | } |
|
| 647 | } |
|
| 648 | } |
|
| 649 | $size = GRAPH_SIZE; // image size |
|
| 650 | $image = imagecreate($size+50, $size+10); |
|
| 651 | ||