Circle

Circle #

PhpTui\Tui\Extension\Core\Shape\CircleShape

Draws a circle at with the specified radius and color

Example #

Show code
<?php

declare(strict_types=1);

use PhpTui\Tui\Canvas\Marker;
use PhpTui\Tui\Color\AnsiColor;
use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Shape\CircleShape;
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget;

require 'vendor/autoload.php';

$display = DisplayBuilder::default()->build();
$display->draw(
    CanvasWidget::fromIntBounds(-1, 21, -1, 21)
        ->marker(Marker::Dot)
        ->draw(CircleShape::fromScalars(10, 10, 10)->color(AnsiColor::Green))
);

Parameters #

Configure the shape using the builder methods named as follows:

NameTypeDescription
positionPhpTui\Tui\Position\FloatPositionPosition of the circle
radiusfloatRadius of the circle
colorPhpTui\Tui\Color\ColorColor of the circle