public function setFromDecoded(Decoded $decoded, $frameIndex = null)
    {
        if (is_null($frameIndex)) {
            // setup from all decoded data
            $width = $decoded->getCanvasWidth();
            $height = $decoded->getCanvasHeight();
            $colorTable = $decoded->getGlobalColorTable();
            $loops = $decoded->getLoops();
            $frames = $decoded->getFrames();
        } else {
            // setup only one specific frame
            $frame = $decoded->getFrame($frameIndex);
            $frame->setOffset(0, 0);
            $width = $frame->decodeWidth();
            $height = $frame->decodeHeight();
            $colorTable = $frame->hasLocalColorTable() ? $frame->getLocalColorTable() : $decoded->getGlobalColorTable();
            $loops = 0;
            $frames = array($frame);
        }

        // setup
        $this->setCanvas($width, $height);
        $this->setGlobalColorTable($colorTable);
        $this->setBackgroundColorIndex($decoded->getBackgroundColorIndex());
        $this->setLoops($loops);
        $this->setFrames($frames);

        return $this;
    }
public function setFromDecoded(Decoded $decoded, $frameIndex = null)
    {
        if (is_null($frameIndex)) {
            // setup from all decoded data
            $width = $decoded->getCanvasWidth();
            $height = $decoded->getCanvasHeight();
            $colorTable = $decoded->getGlobalColorTable();
            $loops = $decoded->getLoops();
            $frames = $decoded->getFrames();
        } else {
            // setup only one specific frame
            $frame = $decoded->getFrame($frameIndex);
            $frame->setOffset(0, 0);
            $width = $frame->decodeWidth();
            $height = $frame->decodeHeight();
            $colorTable = $frame->hasLocalColorTable() ? $frame->getLocalColorTable() : $decoded->getGlobalColorTable();
            $loops = 0;
            $frames = array($frame);
        }

        // setup
        $this->setCanvas($width, $height);
        $this->setGlobalColorTable($colorTable);
        $this->setBackgroundColorIndex($decoded->getBackgroundColorIndex());
        $this->setLoops($loops);
        $this->setFrames($frames);

        return $this;
    }
public function setFromDecoded ( Decoded $ decoded , $ frameIndex = null ) { if ( is_null ( $ frameIndex ) ) { // setup from all decoded data $ width = $ decoded -> getCanvasWidth ( ) ; $ height = $ decoded -> getCanvasHeight ( ) ; $ colorTable = $ decoded -> getGlobalColorTable ( ) ; $ loops = $ decoded -> getLoops ( ) ; $ frames = $ decoded -> getFrames ( ) ; } else { // setup only one specific frame $ frame = $ decoded -> getFrame ( $ frameIndex ) ; $ frame -> setOffset ( 0 , 0 ) ; $ width = $ frame -> decodeWidth ( ) ; $ height = $ frame -> decodeHeight ( ) ; $ colorTable = $ frame -> hasLocalColorTable ( ) ? $ frame -> getLocalColorTable ( ) : $ decoded -> getGlobalColorTable ( ) ; $ loops = 0 ; $ frames = array ( $ frame ) ; } // setup $ this -> setCanvas ( $ width , $ height ) ; $ this -> setGlobalColorTable ( $ colorTable ) ; $ this -> setBackgroundColorIndex ( $ decoded -> getBackgroundColorIndex ( ) ) ; $ this -> setLoops ( $ loops ) ; $ this -> setFrames ( $ frames ) ; return $ this ; }
Setup encoder from Decoded object

@param Decoded  $decoded
@param int|null $frameIndex
@return \Intervention\Image\Gd\Gif\Encoder
Setup encoder from Decoded object