function pChart::drawFilledCircle in Visitors 8
Same name and namespace in other branches
- 7.0 pchart/pChart.inc \pChart::drawFilledCircle()
2 calls to pChart::drawFilledCircle()
- pChart::drawFilledEllipse in pchart/
pChart.inc - pChart::drawPlotGraph in pchart/
pChart.inc
File
- pchart/
pChart.inc, line 2275
Class
Code
function drawFilledCircle($Xc, $Yc, $Height, $R, $G, $B, $Width = 0) {
if ($Width == 0) {
$Width = $Height;
}
if ($R < 0) {
$R = 0;
}
if ($R > 255) {
$R = 255;
}
if ($G < 0) {
$G = 0;
}
if ($G > 255) {
$G = 255;
}
if ($B < 0) {
$B = 0;
}
if ($B > 255) {
$B = 255;
}
$C_Circle = imagecolorallocate($this->Picture, $R, $G, $B);
$Step = 360 / (2 * 3.1418 * max($Width, $Height));
for ($i = 90; $i <= 270; $i = $i + $Step) {
$X1 = cos($i * 3.1418 / 180) * $Height + $Xc;
$Y1 = sin($i * 3.1418 / 180) * $Width + $Yc;
$X2 = cos((180 - $i) * 3.1418 / 180) * $Height + $Xc;
$Y2 = sin((180 - $i) * 3.1418 / 180) * $Width + $Yc;
$this
->drawAntialiasPixel($X1 - 1, $Y1 - 1, $R, $G, $B);
$this
->drawAntialiasPixel($X2 - 1, $Y2 - 1, $R, $G, $B);
if ($Y1 - 1 > $Yc - max($Width, $Height)) {
imageline($this->Picture, $X1, $Y1 - 1, $X2 - 1, $Y2 - 1, $C_Circle);
}
}
}