function pDraw::drawRoundedFilledRectangle_deprecated in Visitors 7
Same name and namespace in other branches
- 7.2 pChart/class/pDraw.class.php \pDraw::drawRoundedFilledRectangle_deprecated()
File
- pChart/
class/ pDraw.class.php, line 356
Class
Code
function drawRoundedFilledRectangle_deprecated($X1, $Y1, $X2, $Y2, $Radius, $Format = "") {
$R = isset($Format["R"]) ? $Format["R"] : 0;
$G = isset($Format["G"]) ? $Format["G"] : 0;
$B = isset($Format["B"]) ? $Format["B"] : 0;
$BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
$BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
$BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
$Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
$Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
if ($Surrounding != NULL) {
$BorderR = $R + $Surrounding;
$BorderG = $G + $Surrounding;
$BorderB = $B + $Surrounding;
}
if ($BorderR == -1) {
$BorderR = $R;
$BorderG = $G;
$BorderB = $B;
}
list($X1, $Y1, $X2, $Y2) = $this
->fixBoxCoordinates($X1, $Y1, $X2, $Y2);
if ($X2 - $X1 < $Radius) {
$Radius = floor(($X2 - $X1 + 2) / 2);
}
if ($Y2 - $Y1 < $Radius) {
$Radius = floor(($Y2 - $Y1 + 2) / 2);
}
$RestoreShadow = $this->Shadow;
if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
$this->Shadow = FALSE;
$this
->drawRoundedFilledRectangle($X1 + $this->ShadowX, $Y1 + $this->ShadowY, $X2 + $this->ShadowX, $Y2 + $this->ShadowY, $Radius, array(
"R" => $this->ShadowR,
"G" => $this->ShadowG,
"B" => $this->ShadowB,
"Alpha" => $this->Shadowa,
));
}
if ($this
->getFirstDecimal($X2) >= 5) {
$XOffset2 = 1;
}
else {
$XOffset2 = 0;
}
if ($this
->getFirstDecimal($X1) <= 5) {
$XOffset1 = 1;
}
else {
$XOffset1 = 0;
}
if (!$this->Antialias) {
$XOffset1 = 1;
$XOffset2 = 1;
}
$YTop = floor($Y1 + $Radius);
$YBottom = floor($Y2 - $Radius);
$this
->drawFilledRectangle($X1 - $XOffset1, $YTop, $X2 + $XOffset2, $YBottom, array(
"R" => $R,
"G" => $G,
"B" => $B,
"Alpha" => $Alpha,
"NoBorder" => TRUE,
));
$Step = 360 / (2 * PI * $Radius);
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $Alpha);
$Color2 = $this
->allocateColor($this->Picture, 255, 0, 0, $Alpha);
$Drawn = "";
if ($Alpha < 100) {
$Drawn[$YTop] = FALSE;
}
if ($Alpha < 100) {
$Drawn[$YBottom] = TRUE;
}
for ($i = 0; $i <= 90; $i = $i + $Step) {
$Xp1 = cos(($i + 180) * PI / 180) * $Radius + $X1 + $Radius;
$Xp2 = cos((90 - $i + 270) * PI / 180) * $Radius + $X2 - $Radius;
$Yp = sin(($i + 180) * PI / 180) * $Radius + $YTop;
if ($this
->getFirstDecimal($Xp1) > 5) {
$XOffset1 = 1;
}
else {
$XOffset1 = 0;
}
if ($this
->getFirstDecimal($Xp2) > 5) {
$XOffset2 = 1;
}
else {
$XOffset2 = 0;
}
if ($this
->getFirstDecimal($Yp) > 5) {
$YOffset = 1;
}
else {
$YOffset = 0;
}
if (!isset($Drawn[$Yp + $YOffset]) || $Alpha == 100) {
imageline($this->Picture, $Xp1 + $XOffset1, $Yp + $YOffset, $Xp2 + $XOffset2, $Yp + $YOffset, $Color);
}
$Drawn[$Yp + $YOffset] = $Xp2;
$Xp1 = cos(($i + 90) * PI / 180) * $Radius + $X1 + $Radius;
$Xp2 = cos((90 - $i) * PI / 180) * $Radius + $X2 - $Radius;
$Yp = sin(($i + 90) * PI / 180) * $Radius + $YBottom;
if ($this
->getFirstDecimal($Xp1) > 7) {
$XOffset1 = 1;
}
else {
$XOffset1 = 0;
}
if ($this
->getFirstDecimal($Xp2) > 7) {
$XOffset2 = 1;
}
else {
$XOffset2 = 0;
}
if ($this
->getFirstDecimal($Yp) > 5) {
$YOffset = 1;
}
else {
$YOffset = 0;
}
if (!isset($Drawn[$Yp + $YOffset]) || $Alpha == 100) {
imageline($this->Picture, $Xp1 + $XOffset1, $Yp + $YOffset, $Xp2 + $XOffset2, $Yp + $YOffset, $Color);
}
$Drawn[$Yp + $YOffset] = $Xp2;
}
$this
->drawRoundedRectangle($X1, $Y1, $X2, $Y2, $Radius, array(
"R" => $BorderR,
"G" => $BorderG,
"B" => $BorderB,
"Alpha" => $Alpha,
));
$this->Shadow = $RestoreShadow;
}