Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Worksheet\Drawing; 4 5 use PhpOffice\PhpSpreadsheet\IComparable; 6 use PhpOffice\PhpSpreadsheet\Style\Color; 7 8 class Shadow implements IComparable 9 { 10 // Shadow alignment 11 const SHADOW_BOTTOM = 'b'; 12 const SHADOW_BOTTOM_LEFT = 'bl'; 13 const SHADOW_BOTTOM_RIGHT = 'br'; 14 const SHADOW_CENTER = 'ctr'; 15 const SHADOW_LEFT = 'l'; 16 const SHADOW_TOP = 't'; 17 const SHADOW_TOP_LEFT = 'tl'; 18 const SHADOW_TOP_RIGHT = 'tr'; 19 20 /** 21 * Visible. 22 * 23 * @var bool 24 */ 25 private $visible; 26 27 /** 28 * Blur radius. 29 * 30 * Defaults to 6 31 * 32 * @var int 33 */ 34 private $blurRadius; 35 36 /** 37 * Shadow distance. 38 * 39 * Defaults to 2 40 * 41 * @var int 42 */ 43 private $distance; 44 45 /** 46 * Shadow direction (in degrees). 47 * 48 * @var int 49 */ 50 private $direction; 51 52 /** 53 * Shadow alignment. 54 * 55 * @var string 56 */ 57 private $alignment; 58 59 /** 60 * Color. 61 * 62 * @var Color 63 */ 64 private $color; 65 66 /** 67 * Alpha. 68 * 69 * @var int 70 */ 71 private $alpha; 72 73 /** 74 * Create a new Shadow. 75 */ 76 public function __construct() 77 { 78 // Initialise values 79 $this->visible = false; 80 $this->blurRadius = 6; 81 $this->distance = 2; 82 $this->direction = 0; 83 $this->alignment = self::SHADOW_BOTTOM_RIGHT; 84 $this->color = new Color(Color::COLOR_BLACK); 85 $this->alpha = 50; 86 } 87 88 /** 89 * Get Visible. 90 * 91 * @return bool 92 */ 93 public function getVisible() 94 { 95 return $this->visible; 96 } 97 98 /** 99 * Set Visible. 100 * 101 * @param bool $visible 102 * 103 * @return $this 104 */ 105 public function setVisible($visible) 106 { 107 $this->visible = $visible; 108 109 return $this; 110 } 111 112 /** 113 * Get Blur radius. 114 * 115 * @return int 116 */ 117 public function getBlurRadius() 118 { 119 return $this->blurRadius; 120 } 121 122 /** 123 * Set Blur radius. 124 * 125 * @param int $blurRadius 126 * 127 * @return $this 128 */ 129 public function setBlurRadius($blurRadius) 130 { 131 $this->blurRadius = $blurRadius; 132 133 return $this; 134 } 135 136 /** 137 * Get Shadow distance. 138 * 139 * @return int 140 */ 141 public function getDistance() 142 { 143 return $this->distance; 144 } 145 146 /** 147 * Set Shadow distance. 148 * 149 * @param int $distance 150 * 151 * @return $this 152 */ 153 public function setDistance($distance) 154 { 155 $this->distance = $distance; 156 157 return $this; 158 } 159 160 /** 161 * Get Shadow direction (in degrees). 162 * 163 * @return int 164 */ 165 public function getDirection() 166 { 167 return $this->direction; 168 } 169 170 /** 171 * Set Shadow direction (in degrees). 172 * 173 * @param int $direction 174 * 175 * @return $this 176 */ 177 public function setDirection($direction) 178 { 179 $this->direction = $direction; 180 181 return $this; 182 } 183 184 /** 185 * Get Shadow alignment. 186 * 187 * @return string 188 */ 189 public function getAlignment() 190 { 191 return $this->alignment; 192 } 193 194 /** 195 * Set Shadow alignment. 196 * 197 * @param string $alignment 198 * 199 * @return $this 200 */ 201 public function setAlignment($alignment) 202 { 203 $this->alignment = $alignment; 204 205 return $this; 206 } 207 208 /** 209 * Get Color. 210 * 211 * @return Color 212 */ 213 public function getColor() 214 { 215 return $this->color; 216 } 217 218 /** 219 * Set Color. 220 * 221 * @return $this 222 */ 223 public function setColor(?Color $color = null) 224 { 225 $this->color = $color; 226 227 return $this; 228 } 229 230 /** 231 * Get Alpha. 232 * 233 * @return int 234 */ 235 public function getAlpha() 236 { 237 return $this->alpha; 238 } 239 240 /** 241 * Set Alpha. 242 * 243 * @param int $alpha 244 * 245 * @return $this 246 */ 247 public function setAlpha($alpha) 248 { 249 $this->alpha = $alpha; 250 251 return $this; 252 } 253 254 /** 255 * Get hash code. 256 * 257 * @return string Hash code 258 */ 259 public function getHashCode() 260 { 261 return md5( 262 ($this->visible ? 't' : 'f') . 263 $this->blurRadius . 264 $this->distance . 265 $this->direction . 266 $this->alignment . 267 $this->color->getHashCode() . 268 $this->alpha . 269 __CLASS__ 270 ); 271 } 272 273 /** 274 * Implement PHP __clone to create a deep clone, not just a shallow copy. 275 */ 276 public function __clone() 277 { 278 $vars = get_object_vars($this); 279 foreach ($vars as $key => $value) { 280 if (is_object($value)) { 281 $this->$key = clone $value; 282 } else { 283 $this->$key = $value; 284 } 285 } 286 } 287 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body