function pChart::drawRoundedRectangle in Visitors 8
Same name and namespace in other branches
- 7.0 pchart/pChart.inc \pChart::drawRoundedRectangle()
2 calls to pChart::drawRoundedRectangle()
- pChart::drawRadarAxis in pchart/
pChart.inc - pChart::printErrors in pchart/
pChart.inc
File
- pchart/
pChart.inc, line 2171
Class
Code
function drawRoundedRectangle($X1, $Y1, $X2, $Y2, $Radius, $R, $G, $B) {
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_Rectangle = imagecolorallocate($this->Picture, $R, $G, $B);
$Step = 90 / (3.1418 * $Radius / 2);
for ($i = 0; $i <= 90; $i = $i + $Step) {
$X = cos(($i + 180) * 3.1418 / 180) * $Radius + $X1 + $Radius;
$Y = sin(($i + 180) * 3.1418 / 180) * $Radius + $Y1 + $Radius;
$this
->drawAntialiasPixel($X, $Y, $R, $G, $B);
$X = cos(($i - 90) * 3.1418 / 180) * $Radius + $X2 - $Radius;
$Y = sin(($i - 90) * 3.1418 / 180) * $Radius + $Y1 + $Radius;
$this
->drawAntialiasPixel($X, $Y, $R, $G, $B);
$X = cos($i * 3.1418 / 180) * $Radius + $X2 - $Radius;
$Y = sin($i * 3.1418 / 180) * $Radius + $Y2 - $Radius;
$this
->drawAntialiasPixel($X, $Y, $R, $G, $B);
$X = cos(($i + 90) * 3.1418 / 180) * $Radius + $X1 + $Radius;
$Y = sin(($i + 90) * 3.1418 / 180) * $Radius + $Y2 - $Radius;
$this
->drawAntialiasPixel($X, $Y, $R, $G, $B);
}
$X1 = $X1 - 0.2;
$Y1 = $Y1 - 0.2;
$X2 = $X2 + 0.2;
$Y2 = $Y2 + 0.2;
$this
->drawLine($X1 + $Radius, $Y1, $X2 - $Radius, $Y1, $R, $G, $B);
$this
->drawLine($X2, $Y1 + $Radius, $X2, $Y2 - $Radius, $R, $G, $B);
$this
->drawLine($X2 - $Radius, $Y2, $X1 + $Radius, $Y2, $R, $G, $B);
$this
->drawLine($X1, $Y2 - $Radius, $X1, $Y1 + $Radius, $R, $G, $B);
}