public function circle($x, $y, $r, $style = '')
{
if ($x < 0) {
$x += $this->w;
}
if ($y < 0) {
$y += $this->h;
}
$style = Horde_String::lower($style);
if ($style == 'f') {
$op = 'f';
// Style is fill only.
} elseif ($style == 'fd' || $style == 'df') {
$op = 'B';
// Style is fill and stroke.
} else {
$op = 'S';
// Style is stroke only.
}
$x = $this->_toPt($x);
$y = $this->_toPt($y);
$r = $this->_toPt($r);
/* Invert the y scale. */
$y = $this->hPt - $y;
/* Length of the Bezier control. */
$b = $r * 0.552;
/* Move from the given origin and set the current point
* to the start of the first Bezier curve. */
$c = sprintf('%.2F %.2F m', $x - $r, $y);
$x = $x - $r;
/* First circle quarter. */
$c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x, $y + $b, $x + $r - $b, $y + $r, $x + $r, $y + $r);
// Final point.
/* Set x/y to the final point. */
$x = $x + $r;
$y = $y + $r;
/* Second circle quarter. */
$c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x + $b, $y, $x + $r, $y - $r + $b, $x + $r, $y - $r);
/* Set x/y to the final point. */
$x = $x + $r;
$y = $y - $r;
/* Third circle quarter. */
$c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c', $x, $y - $b, $x - $r + $b, $y - $r, $x - $r, $y - $r);
/* Set x/y to the final point. */
$x = $x - $r;
$y = $y - $r;
/* Fourth circle quarter. */
$c .= sprintf(' %.2F %.2F %.2F %.2F %.2F %.2F c %s', $x - $b, $y, $x - $r, $y + $r - $b, $x - $r, $y + $r, $op);
/* Output the whole string. */
$this->_out($c);
}