private function buildLogicalScreenDescriptor()
    {
        // gif header
        $descriptor = 'GIF89a';

        // canvas width/height
        $descriptor .= pack('v*', $this->canvasWidth);
        $descriptor .= pack('v*', $this->canvasHeight);

        // packed field
        $colorResolution = 111;
        $sortFlag = 0;

        if ($this->hasGlobalColorTable()) {

            $globalColorTableFlag = 1;
            $globalColorTableSize = log(strlen($this->getGlobalColorTable()) / 3, 2) - 1;
            $globalColorTableSize = decbin($globalColorTableSize);
            $globalColorTableSize = str_pad($globalColorTableSize, 3, 0, STR_PAD_LEFT);

        } else {
            $globalColorTableFlag = 0;
            $globalColorTableSize = 0;
        }

        $packed = $globalColorTableFlag.$colorResolution.$sortFlag.$globalColorTableSize;
        
        $descriptor .= pack('C', bindec($packed));

        // background color index
        $descriptor .= pack('C', $this->backgroundColorIndex);

        // pixel aspect ratio
        $descriptor .= "\x00";

        return $descriptor;
    }
private function buildLogicalScreenDescriptor()
    {
        // gif header
        $descriptor = 'GIF89a';

        // canvas width/height
        $descriptor .= pack('v*', $this->canvasWidth);
        $descriptor .= pack('v*', $this->canvasHeight);

        // packed field
        $colorResolution = 111;
        $sortFlag = 0;

        if ($this->hasGlobalColorTable()) {

            $globalColorTableFlag = 1;
            $globalColorTableSize = log(strlen($this->getGlobalColorTable()) / 3, 2) - 1;
            $globalColorTableSize = decbin($globalColorTableSize);
            $globalColorTableSize = str_pad($globalColorTableSize, 3, 0, STR_PAD_LEFT);

        } else {
            $globalColorTableFlag = 0;
            $globalColorTableSize = 0;
        }

        $packed = $globalColorTableFlag.$colorResolution.$sortFlag.$globalColorTableSize;
        
        $descriptor .= pack('C', bindec($packed));

        // background color index
        $descriptor .= pack('C', $this->backgroundColorIndex);

        // pixel aspect ratio
        $descriptor .= "\x00";

        return $descriptor;
    }
private function buildLogicalScreenDescriptor ( ) { // gif header $ descriptor = 'GIF89a' ; // canvas width/height $ descriptor .= pack ( 'v*' , $ this -> canvasWidth ) ; $ descriptor .= pack ( 'v*' , $ this -> canvasHeight ) ; // packed field $ colorResolution = 111 ; $ sortFlag = 0 ; if ( $ this -> hasGlobalColorTable ( ) ) { $ globalColorTableFlag = 1 ; $ globalColorTableSize = log ( strlen ( $ this -> getGlobalColorTable ( ) ) / 3 , 2 ) - 1 ; $ globalColorTableSize = decbin ( $ globalColorTableSize ) ; $ globalColorTableSize = str_pad ( $ globalColorTableSize , 3 , 0 , STR_PAD_LEFT ) ; } else { $ globalColorTableFlag = 0 ; $ globalColorTableSize = 0 ; } $ packed = $ globalColorTableFlag . $ colorResolution . $ sortFlag . $ globalColorTableSize ; $ descriptor .= pack ( 'C' , bindec ( $ packed ) ) ; // background color index $ descriptor .= pack ( 'C' , $ this -> backgroundColorIndex ) ; // pixel aspect ratio $ descriptor .= "\x00" ; return $ descriptor ; }
Build logical screen descriptor

@return string
Build logical screen descriptor