function pDraw::drawFilledRectangle in Visitors 7.2
Same name and namespace in other branches
- 7 pChart/class/pDraw.class.php \pDraw::drawFilledRectangle()
17 calls to pDraw::drawFilledRectangle()
- pDraw::drawBarChart in pChart/
class/ pDraw.class.php - pDraw::drawDerivative in pChart/
class/ pDraw.class.php - pDraw::drawFromPicture in pChart/
class/ pDraw.class.php - pDraw::drawGradientArea in pChart/
class/ pDraw.class.php - pDraw::drawLabelBox in pChart/
class/ pDraw.class.php
File
- pChart/
class/ pDraw.class.php, line 472
Class
Code
function drawFilledRectangle($X1, $Y1, $X2, $Y2, $Format = "") {
$R = isset($Format["R"]) ? $Format["R"] : 0;
$G = isset($Format["G"]) ? $Format["G"] : 0;
$B = isset($Format["B"]) ? $Format["B"] : 0;
$Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
$BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : -1;
$BorderG = isset($Format["BorderG"]) ? $Format["BorderG"] : -1;
$BorderB = isset($Format["BorderB"]) ? $Format["BorderB"] : -1;
$BorderAlpha = isset($Format["BorderAlpha"]) ? $Format["BorderAlpha"] : $Alpha;
$Surrounding = isset($Format["Surrounding"]) ? $Format["Surrounding"] : NULL;
$Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
$NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : NULL;
$Dash = isset($Format["Dash"]) ? $Format["Dash"] : FALSE;
$DashStep = isset($Format["DashStep"]) ? $Format["DashStep"] : 4;
$DashR = isset($Format["DashR"]) ? $Format["DashR"] : 0;
$DashG = isset($Format["DashG"]) ? $Format["DashG"] : 0;
$DashB = isset($Format["DashB"]) ? $Format["DashB"] : 0;
$NoBorder = isset($Format["NoBorder"]) ? $Format["NoBorder"] : FALSE;
if ($Surrounding != NULL) {
$BorderR = $R + $Surrounding;
$BorderG = $G + $Surrounding;
$BorderB = $B + $Surrounding;
}
if ($X1 > $X2) {
list($X1, $X2) = array(
$X2,
$X1,
);
}
if ($Y1 > $Y2) {
list($Y1, $Y2) = array(
$Y2,
$Y1,
);
}
$RestoreShadow = $this->Shadow;
if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) {
$this->Shadow = FALSE;
$this
->drawFilledRectangle($X1 + $this->ShadowX, $Y1 + $this->ShadowY, $X2 + $this->ShadowX, $Y2 + $this->ShadowY, array(
"R" => $this->ShadowR,
"G" => $this->ShadowG,
"B" => $this->ShadowB,
"Alpha" => $this->Shadowa,
"Ticks" => $Ticks,
"NoAngle" => $NoAngle,
));
}
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $Alpha);
if ($NoAngle) {
imagefilledrectangle($this->Picture, ceil($X1) + 1, ceil($Y1), floor($X2) - 1, floor($Y2), $Color);
imageline($this->Picture, ceil($X1), ceil($Y1) + 1, ceil($X1), floor($Y2) - 1, $Color);
imageline($this->Picture, floor($X2), ceil($Y1) + 1, floor($X2), floor($Y2) - 1, $Color);
}
else {
imagefilledrectangle($this->Picture, ceil($X1), ceil($Y1), floor($X2), floor($Y2), $Color);
}
if ($Dash) {
if ($BorderR != -1) {
$iX1 = $X1 + 1;
$iY1 = $Y1 + 1;
$iX2 = $X2 - 1;
$iY2 = $Y2 - 1;
}
else {
$iX1 = $X1;
$iY1 = $Y1;
$iX2 = $X2;
$iY2 = $Y2;
}
$Color = $this
->allocateColor($this->Picture, $DashR, $DashG, $DashB, $Alpha);
$Y = $iY1 - $DashStep;
for ($X = $iX1; $X <= $iX2 + ($iY2 - $iY1); $X = $X + $DashStep) {
$Y = $Y + $DashStep;
if ($X > $iX2) {
$Xa = $X - ($X - $iX2);
$Ya = $iY1 + ($X - $iX2);
}
else {
$Xa = $X;
$Ya = $iY1;
}
if ($Y > $iY2) {
$Xb = $iX1 + ($Y - $iY2);
$Yb = $Y - ($Y - $iY2);
}
else {
$Xb = $iX1;
$Yb = $Y;
}
imageline($this->Picture, $Xa, $Ya, $Xb, $Yb, $Color);
}
}
if ($this->Antialias && !$NoBorder) {
if ($X1 < ceil($X1)) {
$AlphaA = $Alpha * (ceil($X1) - $X1);
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
imageline($this->Picture, ceil($X1) - 1, ceil($Y1), ceil($X1) - 1, floor($Y2), $Color);
}
if ($Y1 < ceil($Y1)) {
$AlphaA = $Alpha * (ceil($Y1) - $Y1);
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
imageline($this->Picture, ceil($X1), ceil($Y1) - 1, floor($X2), ceil($Y1) - 1, $Color);
}
if ($X2 > floor($X2)) {
$AlphaA = $Alpha * (0.5 - ($X2 - floor($X2)));
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
imageline($this->Picture, floor($X2) + 1, ceil($Y1), floor($X2) + 1, floor($Y2), $Color);
}
if ($Y2 > floor($Y2)) {
$AlphaA = $Alpha * (0.5 - ($Y2 - floor($Y2)));
$Color = $this
->allocateColor($this->Picture, $R, $G, $B, $AlphaA);
imageline($this->Picture, ceil($X1), floor($Y2) + 1, floor($X2), floor($Y2) + 1, $Color);
}
}
if ($BorderR != -1) {
$this
->drawRectangle($X1, $Y1, $X2, $Y2, array(
"R" => $BorderR,
"G" => $BorderG,
"B" => $BorderB,
"Alpha" => $BorderAlpha,
"Ticks" => $Ticks,
"NoAngle" => $NoAngle,
));
}
$this->Shadow = $RestoreShadow;
}