| [ Index ] |
|
Code source de phpMyVisites 2.3 |
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 /** 11 * Draw border 12 * 13 * @package Artichow 14 */ 15 class awBorder { 16 17 /** 18 * Border color 19 * 20 * @var Color 21 */ 22 protected $color; 23 24 /** 25 * Hide border ? 26 * 27 * @var bool 28 */ 29 protected $hide = FALSE; 30 31 /** 32 * Border line style 33 * 34 * @var int 35 */ 36 protected $style; 37 38 /** 39 * Build the border 40 * 41 * @param awColor $color Border color 42 * @param int $style Border style 43 */ 44 public function __construct($color = NULL, $style = awLine::SOLID) { 45 46 $this->setStyle($style); 47 48 if($color instanceof awColor) { 49 $this->setColor($color); 50 } else { 51 $this->setColor(new awBlack); 52 } 53 54 } 55 56 /** 57 * Change border color 58 * This method automatically shows the border if it is hidden 59 * 60 * @param awColor $color 61 */ 62 public function setColor(awColor $color) { 63 $this->color = $color; 64 $this->show(); 65 } 66 67 /** 68 * Change border style 69 * 70 * @param int $style 71 */ 72 public function setStyle($style) { 73 $this->style = (int)$style; 74 } 75 76 /** 77 * Hide border ? 78 * 79 * @param bool $hide 80 */ 81 public function hide($hide = TRUE) { 82 $this->hide = (bool)$hide; 83 } 84 85 /** 86 * Show border ? 87 * 88 * @param bool $show 89 */ 90 public function show($show = TRUE) { 91 $this->hide = (bool)!$show; 92 } 93 94 /** 95 * Is the border visible ? 96 * 97 * @return bool 98 */ 99 public function visible() { 100 return !$this->hide; 101 } 102 103 /** 104 * Draw border as a rectangle 105 * 106 * @param awDrawer $drawer 107 * @param awPoint $p1 Top-left corner 108 * @param awPoint $p2 Bottom-right corner 109 */ 110 public function rectangle(awDrawer $drawer, awPoint $p1, awPoint $p2) { 111 112 // Border is hidden 113 if($this->hide) { 114 return; 115 } 116 117 $line = new awLine; 118 $line->setStyle($this->style); 119 $line->setLocation($p1, $p2); 120 121 $drawer->rectangle($this->color, $line); 122 123 } 124 125 /** 126 * Draw border as an ellipse 127 * 128 * @param awDrawer $drawer 129 * @param awPoint $center Ellipse center 130 * @param int $width Ellipse width 131 * @param int $height Ellipse height 132 */ 133 public function ellipse(awDrawer $drawer, awPoint $center, $width, $height) { 134 135 // Border is hidden 136 if($this->hide) { 137 return; 138 } 139 140 switch($this->style) { 141 142 case awLine::SOLID : 143 $drawer->ellipse($this->color, $center, $width, $height); 144 break; 145 146 default : 147 trigger_error("Dashed and dotted borders and not yet implemented on ellipses", E_USER_ERROR); 148 break; 149 150 } 151 152 153 } 154 155 } 156 157 registerClass('Border'); 158 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 14:10:01 2007 | par Balluche grâce à PHPXref 0.7 |
|