Grafika\Gd\DrawingObject\Ellipse::draw PHP Method

draw() public method

TODO: Anti-aliased curves
public draw ( Grafika\ImageInterface $image ) : Grafika\ImageInterface
$image Grafika\ImageInterface
return Grafika\ImageInterface
    public function draw($image)
    {
        list($x, $y) = $this->pos;
        $left = $x + $this->width / 2;
        $top = $y + $this->height / 2;
        if (null !== $this->fillColor) {
            list($r, $g, $b, $alpha) = $this->fillColor->getRgba();
            $fillColorResource = imagecolorallocatealpha($image->getCore(), $r, $g, $b, Editor::gdAlpha($alpha));
            imagefilledellipse($image->getCore(), $left, $top, $this->width, $this->height, $fillColorResource);
        }
        // Create borders. It will be placed on top of the filled ellipse (if present)
        if (0 < $this->getBorderSize() and null !== $this->borderColor) {
            // With border > 0 AND borderColor !== null
            list($r, $g, $b, $alpha) = $this->borderColor->getRgba();
            $borderColorResource = imagecolorallocatealpha($image->getCore(), $r, $g, $b, Editor::gdAlpha($alpha));
            imageellipse($image->getCore(), $left, $top, $this->width, $this->height, $borderColorResource);
        }
        return $image;
    }
Ellipse