Image #
PhpTui\Tui\Extension\ImageMagick\Shape\ImageShape
Renders an image on the canvas.
Example #
Show code
<?php
declare(strict_types=1);
use PhpTui\Tui\Canvas\Marker;
use PhpTui\Tui\DisplayBuilder;
use PhpTui\Tui\Extension\Core\Widget\CanvasWidget;
use PhpTui\Tui\Extension\ImageMagick\ImageMagickExtension;
use PhpTui\Tui\Extension\ImageMagick\Shape\ImageShape;
require 'vendor/autoload.php';
$display = DisplayBuilder::default()
->addExtension(new ImageMagickExtension())
->build();
$display->draw(
CanvasWidget::fromIntBounds(0, 320, 0, 240)
->marker(Marker::HalfBlock)
->draw(
ImageShape::fromPath(__DIR__ . '/example.jpg')
)
);
Parameters #
Configure the shape using the builder methods named as follows:
Name | Type | Description |
---|---|---|
path | string | Absolute path to the image |
position | PhpTui\Tui\Position\FloatPosition | Position to render at (bottom left) |