GIFReader.st
changeset 1429 28c9e0f9d239
parent 1393 abed635fb3ce
child 1521 3c54279a418c
--- a/GIFReader.st	Wed Nov 15 14:02:23 2000 +0100
+++ b/GIFReader.st	Wed Nov 15 16:05:02 2000 +0100
@@ -15,7 +15,8 @@
 ImageReader subclass:#GIFReader
 	instanceVariableNames:'redMap greenMap blueMap pass xpos ypos rowByteSize remainBitCount
 		bufByte bufStream prefixTable suffixTable clearCode eoiCode
-		freeCode codeSize maxCode interlace frameDelay iterationCount'
+		freeCode codeSize maxCode interlace frameDelay iterationCount
+		leftOffs topOffs'
 	classVariableNames:'ImageSeparator Extension Terminator'
 	poolDictionaries:''
 	category:'Graphics-Images-Support'
@@ -316,11 +317,11 @@
     |byte index flag count fileColorMap
      colorMapSize bitsPerPixel scrWidth scrHeight
      hasColorMap hasLocalColorMap interlaced id
-     leftOffs topOffs codeLen
+     codeLen
      compressedData compressedSize
      tmp srcOffset dstOffset isGif89 atEnd
      h "{ Class: SmallInteger }" 
-     img firstImage firstFrameDelay frame imageCount|
+     img firstImage firstOffset firstFrameDelay frame imageCount|
 
     inStream := aStream.
     aStream binary.
@@ -420,6 +421,7 @@
                     "/ remember first image in case more come later.
                     firstImage := img.
                     firstFrameDelay := frameDelay.
+                    firstOffset := (leftOffs @ topOffs).
                 ] ifFalse:[
                     imageCount == 1 ifTrue:[
                         imageSequence := ImageSequence new.
@@ -428,6 +430,7 @@
                         "/ add frame for first image.
                         frame := ImageFrame new image:firstImage.
                         frame delay:firstFrameDelay.
+                        frame offset:firstOffset.
                         imageSequence add:frame.
                     ].  
                     img := self makeImage.
@@ -436,6 +439,7 @@
                     "/ add frame for this image.
                     frame := ImageFrame new image:img.
                     frame delay:frameDelay.
+                    frame offset:(leftOffs @ topOffs).
                     imageSequence add:frame.
                 ].
 
@@ -564,6 +568,8 @@
 "/                'GIFREADER [info]: mask: ' infoPrint. (maskPixel printStringRadix:16) infoPrintCR.
             ].
 "/            'GIFREADER [info]: animationTime: ' infoPrint. (animationTime * (1/100)) infoPrintCR.
+"/            'GIFREADER [info]: animationType: ' infoPrint. (animationType) infoPrintCR.
+"/            'GIFREADER [info]: animationMask: ' infoPrint. (animationMask) infoPrintCR.
 
             frameDelay := (animationTime * (1/100)) * 1000.
 
@@ -624,7 +630,7 @@
         "/
         "/  image descriptor extension
         "/
-"/        'GIFREADER [info]: image descriptor extension ignored' infoPrintCR.
+        "/ 'GIFREADER [info]: image descriptor extension ignored' infoPrintCR.
         [(subBlockSize := aStream nextByte) > 0] whileTrue:[
             aStream skip:subBlockSize
         ].
@@ -645,13 +651,15 @@
 readImage:aStream
     "read a single image from aStream."
 
-    |leftOffs topOffs flag interlaced hasLocalColorMap bitsPerPixel colorMapSize
+    | flag interlaced hasLocalColorMap bitsPerPixel colorMapSize
      codeLen compressedData compressedSize index count h tmp srcOffset dstOffset
      initialBuffSize|
 
     "get image data"
     leftOffs := aStream nextShortMSB:false.
     topOffs := aStream nextShortMSB:false.
+"/    'GIFReader: leftOffs ' infoPrint. leftOffs infoPrintCR.
+"/    'GIFReader: topOffs ' infoPrint. topOffs infoPrintCR.
     width := aStream nextShortMSB:false.
     height := aStream nextShortMSB:false.
 
@@ -1029,6 +1037,6 @@
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.76 2000-08-16 17:24:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.77 2000-11-15 15:04:52 martin Exp $'
 ! !
 GIFReader initialize!