PHP Classes

File: docs/content/classes/

Recommend this page to a friend!
  Classes of Jose Luis Quintana   GImage   docs/content/classes/   Download  
File: docs/content/classes/
Role: Example script
Content type: text/markdown
Description: Example script
Class: GImage
Create graphic images with a fluent interface
Author: By
Last change:
Date: 8 months ago
Size: 1,001 bytes


Class file image Download


> Canvas represents an area on which it can append images, text and figures.

!!! tip "Note"

__Canvas__ needs a `Figure` or `Image` which will be used as base element (layout).

The following example uses append() method to attach elements to Canvas.

!!! tip "Tip"

Using  `setLeft()` or `setTop()` methods it can control the position (x,y) of the elements (`Figure`, `Image` or `Text`) on `Canvas`.


use GImage\Image;
use GImage\Figure;
use GImage\Canvas;

$image = new Image();

$ellipse = new Figure(200, 200);
    ->setBackgroundColor(200, 0, 0)

// Used as layout
$layout = new Figure(200, 200);
    ->setBackgroundColor(0, 0, 255)

$canvas = new Canvas($layout);
    ->append([$image, $ellipse])