Exemplo n.º 1
0
 /**
  * Initialize a new virgin layer
  * 
  * @param integer $width
  * @param integer $height
  * @param string $backgroundColor
  * 
  * @return ImageWorkshopLayer
  */
 public static function initVirginLayer($width = 100, $height = 100, $backgroundColor = null)
 {
     $opacity = 0;
     if (!$backgroundColor || $backgroundColor == 'transparent') {
         $opacity = 127;
         $backgroundColor = 'ffffff';
     }
     return new ImageWorkshopLayer(ImageWorkshopLib::generateImage($width, $height, $backgroundColor, $opacity));
 }
Exemplo n.º 2
0
 /**
  * Resize the background of a layer.
  *
  * @param int $newWidth
  * @param int $newHeight
  */
 public function resizeBackground($newWidth, $newHeight)
 {
     $oldWidth = $this->width;
     $oldHeight = $this->height;
     $this->width = $newWidth;
     $this->height = $newHeight;
     $virginLayoutImage = ImageWorkshopLib::generateImage($this->width, $this->height);
     imagecopyresampled($virginLayoutImage, $this->image, 0, 0, 0, 0, $this->width, $this->height, $oldWidth, $oldHeight);
     unset($this->image);
     $this->image = $virginLayoutImage;
 }