1. Go to this page and download the library: Download fruit/convas library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fruit / convas example snippets
$buf = new Fruit\Convas\Buffer; // create a canvas, origin point is at top-left corner
$g = new Fruit\Convas\Graphics($buf); // allocate graphics object to paint on this canvas
$g
->transit(2, 3) // move origin to (2, 3)
->drawString(0, 0, 'a string')
->drawString(0, 1, '中文') // convas can handle (most of) CJK and graphical characters
->drawLine(0, 2, 55, 2) // draw a line from (0, 2) to (55, 2)
->drawLine(0, 2, 0, 15) // convas can handle cross point of lines and ellipses
->drawEllipse(2, 5, 55, 20) // draw an ellipse within the square (2, 5) (15, 20)
->setColor(new Fruit\Convas\Color(1, 37, 41)) // set color
->drawString(5, 12, 'highlighted, white text on red background');
echo implode("\n", $buf->exportAll()) . "\n";
$buf->clear(4, 8, 57, 23); // clear the area, take care of the origin point
$g->overwrite = true; // enable overwrite mode, color will always in overwrite mode.
$g->drawLine(5, 2, 5, 15); // no cross point handling
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.