[ Index ] |
|
Code source de Cr@wltr@ck 2.2.1 |
1 <?php 2 /* 3 * This work is hereby released into the Public Domain. 4 * To view a copy of the public domain dedication, 5 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to 6 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. 7 * 8 */ 9 10 require_once dirname(__FILE__)."/../Graph.class.php"; 11 12 /** 13 * To handle text 14 * 15 * @package Artichow 16 */ 17 class awText { 18 19 /** 20 * Your text 21 * 22 * @var string 23 */ 24 var $text; 25 26 /** 27 * Text font 28 * 29 * @var Font 30 */ 31 var $font; 32 33 /** 34 * Text angle 35 * Can be 0 or 90 36 * 37 * @var int 38 */ 39 var $angle; 40 41 /** 42 * Text color 43 * 44 * @var Color 45 */ 46 var $color; 47 48 /** 49 * Text background 50 * 51 * @var Color, Gradient 52 */ 53 var $background; 54 55 /** 56 * Padding 57 * 58 * @var array Array for left, right, top and bottom paddings 59 */ 60 var $padding; 61 62 /** 63 * Text border 64 * 65 * @var Border 66 */ 67 var $border; 68 69 /** 70 * Build a new awtext 71 * 72 * @param string $text Your text 73 */ 74 function awText($text, $font = NULL, $color = NULL, $angle = 0) { 75 76 if(is_null($font)) { 77 $font = new awFont2; 78 } 79 80 $this->setText($text); 81 $this->setFont($font); 82 83 // Set default color to black 84 if($color === NULL) { 85 $color = new awColor(0, 0, 0); 86 } 87 88 $this->setColor($color); 89 $this->setAngle($angle); 90 91 $this->border = new awBorder; 92 $this->border->hide(); 93 94 } 95 96 /** 97 * Get text 98 * 99 * @return string 100 */ 101 function getText() { 102 return $this->text; 103 } 104 105 /** 106 * Change text 107 * 108 * @param string $text New text 109 */ 110 function setText($text) { 111 $this->text = (string)$text; 112 $this->text = str_replace("\r", "", $text); 113 } 114 115 /** 116 * Change text font 117 * 118 * @param Font 119 */ 120 function setFont(&$font) { 121 $this->font = $font; 122 } 123 124 /** 125 * Get text font 126 * 127 * @return int 128 */ 129 function getFont() { 130 return $this->font; 131 } 132 133 /** 134 * Change text angle 135 * 136 * @param int 137 */ 138 function setAngle($angle) { 139 $this->angle = (int)$angle; 140 } 141 142 /** 143 * Get text angle 144 * 145 * @return int 146 */ 147 function getAngle() { 148 return $this->angle; 149 } 150 151 /** 152 * Change text color 153 * 154 * @param Color 155 */ 156 function setColor($color) { 157 $this->color = $color; 158 } 159 160 /** 161 * Get text color 162 * 163 * @return Color 164 */ 165 function getColor() { 166 return $this->color; 167 } 168 169 /** 170 * Change text background color 171 * 172 * @param $color 173 */ 174 function setBackgroundColor($color) { 175 $this->background = $color; 176 } 177 178 /** 179 * Change text background gradient 180 * 181 * @param $gradient 182 */ 183 function setBackgroundGradient($gradient) { 184 $this->background = $gradient; 185 } 186 187 /** 188 * Get text background 189 * 190 * @return Color, Gradient 191 */ 192 function getBackground() { 193 return $this->background; 194 } 195 196 /** 197 * Change padding 198 * 199 * @param int $left Left padding 200 * @param int $right Right padding 201 * @param int $top Top padding 202 * @param int $bottom Bottom padding 203 */ 204 function setPadding($left, $right, $top, $bottom) { 205 $this->padding = array((int)$left, (int)$right, (int)$top, (int)$bottom); 206 } 207 208 /** 209 * Get current padding 210 * 211 * @return array 212 */ 213 function getPadding() { 214 return $this->padding; 215 } 216 217 } 218 219 registerClass('Text'); 220 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Sep 6 14:14:11 2007 | par Balluche grâce à PHPXref 0.7 |