摘要:php畫圓餅圓
<?php
$image = imagecreate(200, 200);
// 指定顏色
$white = imagecolorallocate( $image, 0xFF, 0xFF, 0xFF );
$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);
$green = imagecolorallocate($image, 0x00, 0xFF, 0x00);
$yellow = imagecolorallocate( $image, 0xFF, 0xFF, 0x00 );
// 下半部的立體效果先畫
for ($i = 125; $i > 100; $i--) {
imagefilledarc($image, 100, $i, 200, 100, -30, 45, $darknavy, IMG_ARC_PIE);
imagefilledarc($image, 100, $i, 200, 100, 45, 75 , $darkgray, IMG_ARC_PIE);
imagefilledarc($image, 100, $i, 200, 100, 75, 330 , $darkred, IMG_ARC_PIE);
}
// 之後畫上半部
imagefilledarc($image, 100, 100, 200, 100, -30, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 200, 100, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 200, 100, 75, 200 , $red, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 200, 100, 200, 300 , $yellow, IMG_ARC_PIE);
imagefilledarc($image, 100, 100, 200, 100, 300, 330 , $green, IMG_ARC_PIE);
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文件</title>
</head>
<body>
</body>
</html>