/** * {@inheritdoc} */ public function chord(PointInterface $center, BoxInterface $size, $start, $end, Color $color, $fill = false, $thickness = 1) { $x = $center->getX(); $y = $center->getY(); $width = $size->getWidth(); $height = $size->getHeight(); try { $pixel = $this->getColor($color); $chord = new \GmagickDraw(); $chord->setstrokecolor($pixel); $chord->setstrokewidth(max(1, (int) $thickness)); if ($fill) { $chord->setfillcolor($pixel); } else { $x1 = round($x + $width / 2 * cos(deg2rad($start))); $y1 = round($y + $height / 2 * sin(deg2rad($start))); $x2 = round($x + $width / 2 * cos(deg2rad($end))); $y2 = round($y + $height / 2 * sin(deg2rad($end))); $this->line(new Point($x1, $y1), new Point($x2, $y2), $color); $chord->setfillcolor('transparent'); } $chord->arc($x - $width / 2, $y - $height / 2, $x + $width / 2, $y + $height / 2, $start, $end); $this->gmagick->drawImage($chord); $pixel = null; $chord = null; } catch (\GmagickException $e) { throw new RuntimeException('Draw chord operation failed', $e->getCode(), $e); } return $this; }
public function arc($x, $y, $radius, $startAngle, $endAngle, $anticlockwise = false) { if (self::DEBUG) { echo __FUNCTION__ . "\n"; } $this->canvas->arc($x, $y, $radius, $startAngle, $endAngle); }