gabrielrcouto / php-gui

Extensionless PHP Graphic User Interface library
2.24k stars 175 forks source link

Image component. #158

Closed kingga closed 5 years ago

kingga commented 5 years ago

Added image component by using the canvas component.

<?php

require_once 'vendor/autoload.php';

use Gui\Application;
use Gui\Components\Image;

$app = new Application;

$app->on('start', function () use ($app) {
    $file = sprintf('%s/images/square.png', dirname(__FILE__));
    $imgw = $imgh = 100;

    $image = new Image([
        'top'       => 10,
        'left'      => 10,
        'width'     => $imgw,
        'height'    => $imgh,
    ]);

    $image->setSize($imgw, $imgh)
        ->setFile($file);
});

$app->run();
kingga commented 5 years ago

Revising this now using TImage as larger images can take time to load but I'm just figuring out Pascal & Lazarus right now.