Exemplo n.º 1
0
 /**
  * @param  LayerInterface[] $layers
  * @param  mixed[]          $options
  * @return Image
  */
 public function createImage(array $layers, array $options)
 {
     $this->initContents($layers, $options);
     $contents = $layers[0]->get('final.contents');
     $image = new Image();
     $image->setContents($contents);
     return $image;
 }
Exemplo n.º 2
0
 /**
  * @param  LayerInterface[] $layers
  * @param  mixed[]          $options
  * @return Image
  */
 public function createImage(array $layers, array $options)
 {
     $this->initContents($layers);
     $contents = $layers[0]->get('gif.contents');
     $extracted = $layers[0]->get('gif.extracted');
     $frames = count($extracted);
     $image = new Image();
     $image->setContents($contents);
     $image->addExtras(['total_frames' => $frames]);
     return $image;
 }
Exemplo n.º 3
0
 /**
  * @return Image
  * @api
  */
 public function save()
 {
     try {
         $pass = new DelegatingOptionPass();
         $this->options = $pass->process($this->options);
         TranslatedException::init($this->options);
         TranslatedException::addResourceDir(__DIR__ . '/Resources/translations');
         $pass = new DelegatingLayerPass();
         $this->layers = $pass->process($this->layers);
         $engine = new DelegatingEngine();
         $image = $engine->getImage($this->layers, $this->options);
     } catch (TranslatedException $e) {
         $image = new Image();
         $image->setMessage($e->getMessage());
         $image->setVerboseMessage($e->getVerboseMessage());
     }
     $this->layers = [0 => null];
     return $image;
 }