示例#1
0
文件: Text.php 项目: sokil/php-image
 public function setColor($color)
 {
     $this->_color = Rgb::normalize($color);
     return $this;
 }
示例#2
0
文件: Image.php 项目: sokil/php-image
 /**
  * 
  * @param type $angle
  * @param array $backgroundColor
  */
 public function rotate($angle, $backgroundColor = null)
 {
     $backgroundColor = $backgroundColor ? Rgb::normalize($backgroundColor) : new Rgb(0, 0, 0, 127);
     // create color
     $backgroundColorId = imageColorAllocateAlpha($this->_resource, $backgroundColor->getRed(), $backgroundColor->getGreen(), $backgroundColor->getBlue(), $backgroundColor->getAlpha());
     // rotate image
     $rotatedImageResource = imagerotate($this->_resource, $angle, $backgroundColorId, true);
     imagealphablending($rotatedImageResource, false);
     imagesavealpha($rotatedImageResource, true);
     $this->loadResource($rotatedImageResource);
     return $this;
 }