function pDraw::drawFilledCircle

5.x pDraw.class.php pDraw::drawFilledCircle($X, $Y, $Radius, $Format = "")
4 calls to pDraw::drawFilledCircle()
pDraw::drawLegend in inc/pchart/pchart/class/pDraw.class.php
pDraw::drawShape in inc/pchart/pchart/class/pDraw.class.php
pDraw::drawStackedAreaChart in inc/pchart/pchart/class/pDraw.class.php
pDraw::writeLabel in inc/pchart/pchart/class/pDraw.class.php

File

inc/pchart/pchart/class/pDraw.class.php, line 898

Class

pDraw

Code

function drawFilledCircle($X, $Y, $Radius, $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;
  $Ticks = isset($Format ["Ticks"]) ? $Format ["Ticks"] : NULL;
  $Surrounding = isset($Format ["Surrounding"]) ? $Format ["Surrounding"] : NULL;

  if ($Radius == 0) {
    $Radius = 1;
  }
  if ($Surrounding != NULL) {
    $BorderR = $R + $Surrounding;
    $BorderG = $G + $Surrounding;
    $BorderB = $B + $Surrounding;
  }
  $X = floor($X);
  $Y = floor($Y);

  $Radius = abs($Radius);

  $RestoreShadow = $this->Shadow;
  if ($this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0) 
   {
    $this->Shadow = FALSE;
    $this->drawFilledCircle($X + $this->ShadowX, $Y + $this->ShadowY, $Radius, array("R" => $this->ShadowR, "G" => $this->ShadowG, "B" => $this->ShadowB, "Alpha" => $this->Shadowa, "Ticks" => $Ticks));
  }

  $this->Mask = "";
  $Color = $this->allocateColor($this->Picture, $R, $G, $B, $Alpha);
  for ($i = 0; $i <= $Radius * 2; $i++) 
   {
    $Slice = sqrt($Radius * $Radius - ($Radius - $i) * ($Radius - $i));
    $XPos = floor($Slice);
    $YPos = $Y + $i - $Radius;
    $AAlias = $Slice - floor($Slice);

    $this->Mask [$X -$XPos][$YPos] = TRUE;
    $this->Mask [$X + $XPos][$YPos] = TRUE;
    imageline($this->Picture, $X -$XPos, $YPos, $X + $XPos, $YPos, $Color);
  }
  if ($this->Antialias) {
    $this->drawCircle($X, $Y, $Radius, $Radius, array("R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks));
  }

  $this->Mask = "";

  if ($BorderR != -1) {
    $this->drawCircle($X, $Y, $Radius, $Radius, array("R" => $BorderR, "G" => $BorderG, "B" => $BorderB, "Alpha" => $BorderAlpha, "Ticks" => $Ticks));
  }

  $this->Shadow = $RestoreShadow;
}