Вход Регистрация
Файл: sys/classes/gifdecoder.class.php
Строк: 49
<?php

Class GIFDecoder {
    public 
$GIF_buffer = Array ( );
    public 
$GIF_arrays = Array ( );
    public 
$GIF_delays = Array ( );
    public 
$GIF_offset = Array ( );
    public 
$GIF_stream "";
    public 
$GIF_string "";
    public 
$GIF_bfseek 0;
    public 
$GIF_screen = Array ( );
    public 
$GIF_global = Array ( );
    public 
$GIF_sorted;
    public 
$GIF_colorS;
    public 
$GIF_colorC;
    public 
$GIF_colorF;

    function 
GIFDecoder $GIF_pointer ) {
        
$this->GIF_stream $GIF_pointer;
        
GIFDecoder::GIFGetByte );
        
GIFDecoder::GIFGetByte );


        
$this->GIF_screen $this->GIF_buffer;
        
$this->GIF_colorF $this->GIF_buffer ] & 0x80 0;
        
$this->GIF_sorted $this->GIF_buffer ] & 0x08 0;
        
$this->GIF_colorC $this->GIF_buffer ] & 0x07;
        
$this->GIF_colorS << $this->GIF_colorC;

        if ( 
$this->GIF_colorF == ) {
            
GIFDecoder::GIFGetByte $this->GIF_colorS );
            
$this->GIF_global $this->GIF_buffer;
        }

        for ( 
$cycle 1$cycle; ) {
            if ( 
GIFDecoder::GIFGetByte ) ) {
                switch ( 
$this->GIF_buffer ] ) {
                    case 
0x21:
                        
GIFDecoder::GIFReadExtensions ( );
                        break;
                    case 
0x2C:
                        
GIFDecoder::GIFReadDescriptor ( );
                        break;
                    case 
0x3B:
                        
$cycle 0;
                        break;
                }
            }
            else {
                
$cycle 0;
            }
        }
    }

    function 
GIFReadExtensions ( ) {
        
GIFDecoder::GIFGetByte );
        for ( ; ; ) {
            
GIFDecoder::GIFGetByte );
            if ( ( 
$u $this->GIF_buffer ] ) == 0x00 ) {
                break;
            }
            
GIFDecoder::GIFGetByte $u );

            if ( 
$u == ) {
                
$this->GIF_delays [ ] = ( $this->GIF_buffer ] | $this->GIF_buffer ] << );
            }
        }
    }

    function 
GIFReadDescriptor ( ) {
        
$GIF_screen    = Array ( );

        
GIFDecoder::GIFGetByte );
        
$GIF_screen $this->GIF_buffer;

        
$this->GIF_offset [ ] = Array ( ( $this->GIF_buffer ] | $this->GIF_buffer ] << ), ( $this->GIF_buffer ] | $this->GIF_buffer ] << ) );
        
$GIF_colorF $this->GIF_buffer ] & 0x80 0;
        if ( 
$GIF_colorF ) {
            
$GIF_code $this->GIF_buffer ] & 0x07;
            
$GIF_sort $this->GIF_buffer ] & 0x20 0;
        }
        else {
            
$GIF_code $this->GIF_colorC;
            
$GIF_sort $this->GIF_sorted;
        }
        
$GIF_size << $GIF_code;
        
$this->GIF_screen ] &= 0x70;
        
$this->GIF_screen ] |= 0x80;
        
$this->GIF_screen ] |= $GIF_code;
        if ( 
$GIF_sort ) {
            
$this->GIF_screen ] |= 0x08;
        }
        
$this->GIF_string "GIF87a";
        
GIFDecoder::GIFPutByte $this->GIF_screen );
        if ( 
$GIF_colorF == ) {
            
GIFDecoder::GIFGetByte $GIF_size );
            
GIFDecoder::GIFPutByte $this->GIF_buffer );
        }
        else {
            
GIFDecoder::GIFPutByte $this->GIF_global );
        }
        
$this->GIF_string .= chr 0x2C );
        
$GIF_screen ] &= 0x40;
        
GIFDecoder::GIFPutByte $GIF_screen );
        
GIFDecoder::GIFGetByte );
        
GIFDecoder::GIFPutByte $this->GIF_buffer );
        for ( ; ; ) {
            
GIFDecoder::GIFGetByte );
            
GIFDecoder::GIFPutByte $this->GIF_buffer );
            if ( ( 
$u $this->GIF_buffer ] ) == 0x00 ) {
                break;
            }
            
GIFDecoder::GIFGetByte $u );
            
GIFDecoder::GIFPutByte $this->GIF_buffer );
        }
        
$this->GIF_string .= chr 0x3B );
        
$this->GIF_arrays [ ] = $this->GIF_string;
    }

    function 
GIFGetByte $len ) {
        
$this->GIF_buffer = Array ( );

        for ( 
$i 0$i $len$i++ ) {
            if ( 
$this->GIF_bfseek strlen $this->GIF_stream ) ) {
                return 
0;
            }
            
$this->GIF_buffer [ ] = ord $this->GIF_stream $this->GIF_bfseek++ } );
        }
        return 
1;
    }

    function 
GIFPutByte $bytes ) {
        for ( 
$i 0$i count $bytes ); $i++ ) {
            
$this->GIF_string .= chr $bytes $i ] );
        }
    }

    function 
GIFGetFrames ( ) {
        return ( 
$this->GIF_arrays );
    }

    function 
GIFGetDelays ( ) {
        return ( 
$this->GIF_delays );
    }

    function 
GIFGetOffset ( ) {
        return ( 
$this->GIF_offset );
    }
}
?>
Онлайн: 1
Реклама