oops - position incompatibility fixed
authorClaus Gittinger <cg@exept.de>
Sat, 21 Jun 2003 11:56:00 +0200
changeset 1785 16917d309b46
parent 1784 67f412dd5926
child 1786 3f1b68d26446
oops - position incompatibility fixed
TIFFReader.st
--- a/TIFFReader.st	Thu Jun 12 13:09:59 2003 +0200
+++ b/TIFFReader.st	Sat Jun 21 11:56:00 2003 +0200
@@ -188,7 +188,7 @@
             ^ self
         ].
         (tagType == 258) ifTrue:[
-            "bitspersample"
+            "bitspersample"  
              bitsPerSample := valueArray.
 
     "/        'bitspersample ' print. bitsPerSample printNewline.
@@ -1438,7 +1438,7 @@
                     ^ self fileFormatError:'only non separate planes supported'.
                 ].
                 bitsPerSample ~= #(8 8 8) ifTrue:[
-                    ^ self fileFormatError:'only 8/8/8 rgb images supported'.
+                    ^ self fileFormatError:'only 8/8/8 rgb images supported (is: ' , bitsPerSample printString , ')'.
                 ].
                 bitsPerPixel := 24
             ] ifFalse:[
@@ -1597,16 +1597,16 @@
 'bitsPerSample: ' print. bitsPerSample printNewline.
 'store bitspersample at: ' print. outStream position printNewline.
 "
-    bitsPerSamplePos := outStream position.
+    bitsPerSamplePos := outStream position0Based.
     bitsPerSample do:[:n |
-	self writeShort:n
+        self writeShort:n
     ]
 !
 
 writeColorMap
     |n|
 
-    colorMapPos := outStream position.
+    colorMapPos := outStream position0Based.
     #(red green blue) do:[:component |
         n := 0.
         colorMap do:[:clr |
@@ -1642,9 +1642,9 @@
 'stripByteCounts: ' print. stripByteCounts printNewline.
 'store stripbytecounts at: ' print. outStream position printNewline.
 "
-    stripByteCountsPos := outStream position.
+    stripByteCountsPos := outStream position0Based.
     stripByteCounts do:[:c |
-	self writeShort:c
+        self writeShort:c
     ]
 !
 
@@ -1653,9 +1653,9 @@
 'stripOffsets: ' print. stripOffsets printNewline.
 'store stripoffsets at: ' print. outStream position printNewline.
 "
-    stripOffsetsPos := outStream position.
+    stripOffsetsPos := outStream position0Based.
     stripOffsets do:[:o |
-	self writeLong:o
+        self writeLong:o
     ]
 !
 
@@ -1690,7 +1690,7 @@
     ].
     (tagType == 258) ifTrue:[
         "bitspersample"
-        address := bitsPerSamplePos - 1.
+        address := bitsPerSamplePos.
         numberType := #short.
         count := bitsPerSample size.
         valueArray := bitsPerSample
@@ -1754,7 +1754,7 @@
     ].
     (tagType == 273) ifTrue:[
         "stripoffsets"
-        address := stripOffsetsPos - 1.
+        address := stripOffsetsPos.
         numberType := #long.
         count := stripOffsets size.
         valueArray := stripOffsets
@@ -1773,7 +1773,7 @@
     ].
     (tagType == 279) ifTrue:[
         "stripbytecount"
-        address := stripByteCountsPos - 1.
+        address := stripByteCountsPos.
         numberType := #short.
         count := stripByteCounts size.
         valueArray := stripByteCounts
@@ -1848,7 +1848,7 @@
     ].
     (tagType == 320) ifTrue:[
         "colormap"
-        address := colorMapPos - 1.
+        address := colorMapPos.
         numberType := #short.
         count := 256 "(colorMap at:1) size" * 3.
     ].
@@ -2154,6 +2154,7 @@
     photometric := image photometric.
     samplesPerPixel := image samplesPerPixel.
     bitsPerSample := image bitsPerSample.
+
     colorMap := image colorMap.
     planarConfiguration := 1.
     compression := 1.   "none"
@@ -2220,7 +2221,7 @@
 !TIFFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.73 2003-05-07 14:12:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.74 2003-06-21 09:56:00 cg Exp $'
 ! !
 
 TIFFReader initialize!