1<?php 2 3/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ 4 5/** 6 * This is just a basic example with some non-specific geometric shapes and 7 * texts. 8 * 9 * LICENSE: This library is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as published by 11 * the Free Software Foundation; either version 2.1 of the License, or (at your 12 * option) any later version. This library is distributed in the hope that it 13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 15 * General Public License for more details. You should have received a copy of 16 * the GNU Lesser General Public License along with this library; if not, write 17 * to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 * 02111-1307 USA 19 * 20 * @category Images 21 * @package Image_Canvas 22 * @author Jesper Veggerby <pear.nosey@veggerby.dk> 23 * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen 24 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 25 * @version CVS: $Id: canvas.php 262259 2008-07-08 11:45:42Z steinm $ 26 * @link http://pear.php.net/package/Image_Canvas 27 */ 28 29include_once 'Image/Canvas.php'; 30 31$Canvas =& Image_Canvas::factory((isset($_GET['canvas']) ? $_GET['canvas'] : 'png'), array('width' => 400, 'height' => 300)); 32 33$Canvas->setLineColor('black'); 34$Canvas->rectangle(array('x0' => 0, 'y0' => 0, 'x1' => 399, 'y1' => 299)); 35 36$Canvas->setGradientFill(array('direction' => 'horizontal', 'start' => 'red', 'end' => 'blue')); 37$Canvas->setLineColor('black'); 38$Canvas->ellipse(array('x' => 199, 'y' => 149, 'rx' => 50, 'ry' => 50)); 39 40$Canvas->setFont(array('name' => 'Arial', 'size' => 12)); 41$Canvas->addText(array('x' => 0, 'y' => 0, 'text' => 'Demonstration of what Image_Canvas do!')); 42 43$Canvas->setFont(array('name' => 'Times New Roman', 'size' => 12)); 44$Canvas->addText(array('x' => 399, 'y' => 20, 'text' => 'This does not demonstrate what is does!', 'alignment' => array('horizontal' => 'right'))); 45 46$Canvas->setFont(array('name' => 'Courier New', 'size' => 7, 'angle' => 270)); 47$Canvas->addText(array('x' => 350, 'y' => 50, 'text' => 'True, but it\'s all independent of the format!', 'alignment' => array('horizontal' => 'right'))); 48 49$Canvas->setFont(array('name' => 'Garamond', 'size' => 10)); 50$Canvas->addText(array('x' => 199, 'y' => 295, 'text' => '[Changing format is done by changing 3 letters in the source]', 'alignment' => array('horizontal' => 'center', 'vertical' => 'bottom'))); 51 52$Canvas->addVertex(array('x' => 50, 'y' => 200)); 53$Canvas->addVertex(array('x' => 100, 'y' => 200)); 54$Canvas->addVertex(array('x' => 100, 'y' => 250)); 55$Canvas->setFillColor('red@0.2'); 56$Canvas->polygon(array('connect' => true)); 57 58$Canvas->image(array('x' => 398, 'y' => 298, 'filename' => './pear-icon.png', 'alignment' => array('horizontal' => 'right', 'vertical' => 'bottom'))); 59 60$Canvas->show(); 61?> 62