public function drawArc($x, $y, $start, $end, $w, $h = null)
{
$wid = $w * 2;
$hgt = (null === $h ? $w : $h) * 2;
// Create an image resource.
$this->createResource();
// Set fill color and create rectangle.
if (null === $this->fillColor && null === $this->backgroundColor) {
$fill = $this->setColor(new Rgb(255, 255, 255));
} else {
if (null === $this->fillColor) {
$fill = $this->setColor($this->backgroundColor);
} else {
$fill = $this->setColor($this->fillColor);
}
}
imagefilledarc($this->resource, $x, $y, $wid, $hgt, $start, $end, $fill, IMG_ARC_PIE);
// Create stroke, if applicable.
if (null !== $this->strokeColor) {
$x1 = $w * cos($start / 180 * pi());
$y1 = $h * sin($start / 180 * pi());
$x2 = $w * cos($end / 180 * pi());
$y2 = $h * sin($end / 180 * pi());
$stroke = $this->setColor($this->strokeColor);
if (null === $this->strokeWidth) {
$this->strokeWidth = 1;
}
imagesetthickness($this->resource, $this->strokeWidth);
imagearc($this->resource, $x, $y, $wid, $hgt, $start, $end, $stroke);
imageline($this->resource, $x, $y, $x + $x1, $y + $y1, $stroke);
imageline($this->resource, $x, $y, $x + $x2, $y + $y2, $stroke);
}
$this->output = $this->resource;
return $this;
}