cvs: pear /Image_Graph/tests README driver_gradients.php driver_text.php

From: Date: Thu, 16 Dec 2004 08:50:44 +0000
Subject: cvs: pear /Image_Graph/tests README driver_gradients.php driver_text.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-27478@lists.php.net to get a copy of this message
nosey Thu Dec 16 03:50:44 2004 EDT Added files: /pear/Image_Graph/tests driver_text.php driver_gradients.php README Log: Checkin of updated source from previous CVS http://cvs.php.net/co.php/pear/Image_Graph/tests/driver_text.php?r=1.1&p=1 Index: pear/Image_Graph/tests/driver_text.php +++ pear/Image_Graph/tests/driver_text.php <?php // Requires Refsan font include 'Image/Graph/Driver.php'; $driver =& Image_Graph_Driver::factory( (isset($_GET['driver']) ? $_GET['driver'] : 'png'), array('width' => 300, 'height' => 200) ); $driver->setLineColor('black'); $driver->rectangle(0, 0, $driver->getWidth() - 1, $driver->getHeight() - 1); $driver->setLineColor('lightgrey@0.3'); $driver->rectangle(10, 10, 290, 190); $driver->setLineColor('lightgrey@0.3'); $driver->line(10, 100, 290, 100); $driver->setLineColor('lightgrey@0.3'); $driver->rectangle(150, 10, 150, 190); $font = array('ttf' => 'Sans Serif', 'size' => 12, 'angle' => 0, 'vertical' => false); $align = array( array( IMAGE_GRAPH_ALIGN_LEFT + IMAGE_GRAPH_ALIGN_TOP, IMAGE_GRAPH_ALIGN_CENTER_X + IMAGE_GRAPH_ALIGN_TOP, IMAGE_GRAPH_ALIGN_RIGHT + IMAGE_GRAPH_ALIGN_TOP ), array( IMAGE_GRAPH_ALIGN_LEFT + IMAGE_GRAPH_ALIGN_CENTER_Y, IMAGE_GRAPH_ALIGN_CENTER_X + IMAGE_GRAPH_ALIGN_CENTER_Y, IMAGE_GRAPH_ALIGN_RIGHT + IMAGE_GRAPH_ALIGN_CENTER_Y ), array( IMAGE_GRAPH_ALIGN_LEFT + IMAGE_GRAPH_ALIGN_BOTTOM, IMAGE_GRAPH_ALIGN_CENTER_X + IMAGE_GRAPH_ALIGN_BOTTOM, IMAGE_GRAPH_ALIGN_RIGHT + IMAGE_GRAPH_ALIGN_BOTTOM ) ); for ($row = 0; $row < 3; $row++) { for ($col = 0; $col < 3; $col++) { $x = 10 + $col * 140; $y = 10 + $row * 90; switch ($row) { case 0: $text = 'Top'; break; case 1: $text = 'Center'; break; case 2: $text = 'Bottom'; break; } switch ($col) { case 0: $text .= 'Left'; break; case 1: if ($row !== 1) { $text .= 'Center'; } break; case 2: $text .= 'Right'; break; } $driver->setLineColor('red'); $driver->line($x - 5, $y, $x + 5, $y); $driver->setLineColor('red'); $driver->line($x, $y - 5, $x, $y + 5); $driver->setFont($font); $driver->write($x, $y, $text, $align[$row][$col]); } } $driver->done(); ?> http://cvs.php.net/co.php/pear/Image_Graph/tests/driver_gradients.php?r=1.1&p=1 Index: pear/Image_Graph/tests/driver_gradients.php +++ pear/Image_Graph/tests/driver_gradients.php <?php include 'Image/Graph/Driver.php'; $driver =& Image_Graph_Driver::factory( (isset($_GET['driver']) ? $_GET['driver'] : 'png'), array('width' => 605, 'height' => 350) ); $gradient = array( 'type' => 'gradient', 'start' => 'yellow', 'end' => 'maroon' ); $space = 10; $size = 75; $driver->setLineColor('black'); $driver->rectangle(0, 0, $driver->getWidth() - 1, $driver->getHeight() - 1); for ($i = 0; $i < 7; $i ++) {// there are 7 different gradient types $gradient['direction'] = $i + 1; $x = $space + ($i * ($size + $space)); $y = $space; $driver->setGradientFill($gradient); $driver->rectangle($x, $y, $x + $size, $y + $size); $y += $size + $space; $driver->setGradientFill($gradient); $driver->ellipse($x + $size / 2, $y + $size / 2, $size / 2, $size / 2); $y += $size + $space; $driver->setGradientFill($gradient); $driver->pieSlice($x + $size / 2, $y + $size / 2, $size / 2, $size / 2, 45, 270); $y += $size + $space; $points = array(); $points[] = array('x' => $x + $size / 3, 'y' => $y); $points[] = array('x' => $x + $size, 'y' => $y + $size / 2); $points[] = array('x' => $x + $size / 3, 'y' => $y + 3 * $size / 4); $points[] = array('x' => $x + $size / 5, 'y' => $y + $size); $points[] = array('x' => $x, 'y' => $y + $size / 3); $y += $size + $space; $driver->setGradientFill($gradient); foreach ($points as $point) { $driver->polygonAdd($point['x'], $point['y']); } $driver->polygonEnd(true); } $driver->done(); ?>

« previous php.pear.cvs (#27478) next »