GIFReader.st
changeset 625 72c766a86a0e
parent 623 ea587e8fd435
child 626 90e1164410f0
equal deleted inserted replaced
624:e7e4c54dccdc 625:72c766a86a0e
   376 
   376 
   377     |type blockSize subBlockSize
   377     |type blockSize subBlockSize
   378      aspNum aspDen left top width height cWidth cHeight fg bg
   378      aspNum aspDen left top width height cWidth cHeight fg bg
   379      animationType animationTime animationMask
   379      animationType animationTime animationMask
   380      appID appAUTH
   380      appID appAUTH
   381      iterationCount b|
   381      iterationCount b ok|
   382 
   382 
   383     type := aStream nextByte.
   383     type := aStream nextByte.
   384     type == $R asciiValue ifTrue:[
   384     type == $R asciiValue ifTrue:[
   385         "/
   385         "/
   386         "/ Ratio extension
   386         "/ Ratio extension
   403 
   403 
   404     type == 16r01 ifTrue:[
   404     type == 16r01 ifTrue:[
   405         "/
   405         "/
   406         "/ plaintext extension
   406         "/ plaintext extension
   407         "/
   407         "/
   408         'GIFREADER [info]: plaintext extension ignored' infoPrintCR.
   408 "/        'GIFREADER [info]: plaintext extension ignored' infoPrintCR.
   409         subBlockSize := aStream nextByte.
   409         subBlockSize := aStream nextByte.
   410         left := aStream nextShortMSB:false.
   410         left := aStream nextShortMSB:false.
   411         top := aStream nextShortMSB:false.
   411         top := aStream nextShortMSB:false.
   412         width := aStream nextShortMSB:false.
   412         width := aStream nextShortMSB:false.
   413         height := aStream nextShortMSB:false.
   413         height := aStream nextShortMSB:false.
   438 
   438 
   439         (animationType bitTest: 1) ifTrue:[
   439         (animationType bitTest: 1) ifTrue:[
   440             maskPixelValue := animationMask.
   440             maskPixelValue := animationMask.
   441 "/            'GIFREADER [info]: mask: ' infoPrint. (maskPixelValue printStringRadix:16) infoPrintCR.
   441 "/            'GIFREADER [info]: mask: ' infoPrint. (maskPixelValue printStringRadix:16) infoPrintCR.
   442         ].
   442         ].
   443   'GIFREADER [info]: animationTime: ' infoPrint. (animationTime * (1/100)) infoPrintCR.
   443 "/      'GIFREADER [info]: animationTime: ' infoPrint. (animationTime * (1/100)) infoPrintCR.
   444 
   444 
   445         [(subBlockSize := aStream nextByte) > 0] whileTrue:[
   445         [(subBlockSize := aStream nextByte) > 0] whileTrue:[
   446             aStream skip:subBlockSize
   446             aStream skip:subBlockSize
   447         ].
   447         ].
   448         ^ self
   448         ^ self
   450 
   450 
   451     type == 16rFE ifTrue:[
   451     type == 16rFE ifTrue:[
   452         "/
   452         "/
   453         "/ comment extension
   453         "/ comment extension
   454         "/
   454         "/
   455         'GIFREADER [info]: comment extension ignored' infoPrintCR.
   455 "/        'GIFREADER [info]: comment extension ignored' infoPrintCR.
   456         [(blockSize := aStream nextByte) ~~ 0] whileTrue:[
   456         [(blockSize := aStream nextByte) ~~ 0] whileTrue:[
   457             aStream skip:blockSize
   457             aStream skip:blockSize
   458         ].
   458         ].
   459         ^ self
   459         ^ self
   460     ].
   460     ].
   467         appID := (aStream nextBytes:8 ) asString.
   467         appID := (aStream nextBytes:8 ) asString.
   468         appAUTH := aStream nextBytes:3.
   468         appAUTH := aStream nextBytes:3.
   469 
   469 
   470         subBlockSize := aStream nextByte.
   470         subBlockSize := aStream nextByte.
   471 
   471 
       
   472         ok := false.
   472         appID = 'NETSCAPE' ifTrue:[
   473         appID = 'NETSCAPE' ifTrue:[
   473             appAUTH asString = '2.0' ifTrue:[
   474             appAUTH asString = '2.0' ifTrue:[
   474                 subBlockSize == 3 ifTrue:[
   475                 subBlockSize == 3 ifTrue:[
   475                     b := aStream nextByte.
   476                     b := aStream nextByte.
   476                     iterationCount := aStream nextShortMSB:false.
   477                     iterationCount := aStream nextShortMSB:false.
   477                     subBlockSize := aStream nextByte.
   478                     subBlockSize := aStream nextByte.
       
   479                     ok := true.
   478                 ]
   480                 ]
   479             ]
   481             ]
   480         ].
   482         ].
   481 
   483         appID = 'MACGCon' ifTrue:[
   482         ('GIFREADER [info]: application extension (' , appID , ') ignored') infoPrintCR.
   484             "/ what is this ?
       
   485         ].
       
   486 
       
   487         ok ifFalse:[
       
   488             ('GIFREADER [info]: application extension (' , appID , ') ignored') infoPrintCR.
       
   489         ].
       
   490 
   483         [subBlockSize > 0] whileTrue:[
   491         [subBlockSize > 0] whileTrue:[
   484             aStream skip:subBlockSize.
   492             aStream skip:subBlockSize.
   485             subBlockSize := aStream nextByte.
   493             subBlockSize := aStream nextByte.
   486         ].
   494         ].
   487         ^ self
   495         ^ self
   504     'GIFREADER [info]: unknown extension ignored' infoPrintCR.
   512     'GIFREADER [info]: unknown extension ignored' infoPrintCR.
   505     [(subBlockSize := aStream nextByte) > 0] whileTrue:[
   513     [(subBlockSize := aStream nextByte) > 0] whileTrue:[
   506         aStream skip:subBlockSize
   514         aStream skip:subBlockSize
   507     ]
   515     ]
   508 
   516 
   509     "Modified: 21.6.1997 / 11:59:05 / cg"
   517     "Modified: 24.6.1997 / 22:44:15 / cg"
   510 ! !
   518 ! !
   511 
   519 
   512 !GIFReader class methodsFor:'documentation'!
   520 !GIFReader class methodsFor:'documentation'!
   513 
   521 
   514 version
   522 version
   515     ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.51 1997-06-24 20:04:49 cg Exp $'
   523     ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.52 1997-06-24 20:44:29 cg Exp $'
   516 ! !
   524 ! !
   517 GIFReader initialize!
   525 GIFReader initialize!