Points #
PhpTui\Tui\Extension\Core\Shape\PointsShape
Render a set of points on the canvas.
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\PointsShape;
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget;
require 'vendor/autoload.php';
$display = DisplayBuilder::default()->build();
$display->draw(
CanvasWidget::fromIntBounds(0, 10, 0, 10)
->marker(Marker::Dot)
->draw(
PointsShape::new([
[0, 0],
[2, 2],
[4, 4],
[6, 6],
[8, 8],
], AnsiColor::Cyan)
)
);
Parameters #
Configure the shape using the builder methods named as follows:
Name | Type | Description |
---|---|---|
coords | array | Set of coordinates to draw, e.g. [[0.0, 0.0], [2.0, 2.0], [4.0,4.0]] |
color | PhpTui\Tui\Color\Color | Color of the points |