Exemplo n.º 1
0
 public function perfectOverlay(Lib $overlayImage)
 {
     if ($overlayImage->getWidth() == $this->getWidth() && $overlayImage->getHeight() == $this->getHeight()) {
         goto overlay;
     }
     $ratio = max($this->getWidth() / $overlayImage->getWidth(), $this->getHeight() / $overlayImage->getHeight());
     $size = new Size($overlayImage->getWidth() * $ratio, $overlayImage->getHeight() * $ratio);
     $overlayImage->resize($size);
     overlay:
     $this->overlay($overlayImage, new Center($this, $overlayImage));
 }
Exemplo n.º 2
0
 public function __construct(Lib $backgroundImage, Lib $overlayImage)
 {
     $x = $backgroundImage->getWidth() - $overlayImage->getWidth();
     $y = $backgroundImage->getHeight() - $overlayImage->getHeight();
     parent::__construct($x, $y);
 }
Exemplo n.º 3
0
 public static function byPercent(Lib $image, $value)
 {
     $ratio = max($image->getWidth(), $image->getHeight()) * $value / 100;
     return new self($image->getWidth() * $ratio, $image->getHeight() * $ratio);
 }