*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 31 Jan 1997 10:52:18 +0100
changeset 1300 1416ad43b694
parent 1299 5ebe6f8165cf
child 1301 7b7763fedfba
*** empty log message ***
ImageRdr.st
ImageReader.st
--- a/ImageRdr.st	Wed Jan 29 20:59:32 1997 +0100
+++ b/ImageRdr.st	Fri Jan 31 10:52:18 1997 +0100
@@ -1259,14 +1259,12 @@
      to a pipe for the uncompressor. Otherwise, return a stream to read
      the file directly."
 
-    |inStream name|
+    |inStream name fn|
 
     name := aFilename asString.
     ((name endsWith:'.Z') or:[name endsWith:'.gz']) ifTrue:[
-        inStream := PipeStream readingFrom:'gunzip < ' , name.
-        inStream isNil ifTrue:[
-            inStream := PipeStream readingFrom:'uncompress < ' , name.
-        ]
+        fn := Smalltalk getSystemFileName:name.
+        inStream := PipeStream readingFrom:'gunzip < ' , fn.
     ] ifFalse:[
         inStream := Smalltalk systemFileStreamFor:aFilename.
         inStream isNil ifTrue:[
@@ -1278,7 +1276,7 @@
     ].
     ^ inStream
 
-    "Modified: 10.1.1997 / 17:54:01 / cg"
+    "Modified: 31.1.1997 / 10:37:24 / cg"
 ! !
 
 !ImageReader class methodsFor:'image reading'!
@@ -1354,6 +1352,14 @@
     ^ (bitsPerSample inject:0 into:[:sum :i | sum + i])
 !
 
+bitsPerRow
+    "return the number of bits in one scanline of the image"
+
+    ^  width * (self bitsPerPixel).
+
+    "Created: 31.1.1997 / 10:38:42 / cg"
+!
+
 bitsPerSample
     "return the number of bits per sample"
 
@@ -1362,6 +1368,21 @@
     "Modified: 22.4.1996 / 19:15:18 / cg"
 !
 
+bytesPerRow
+    "return the number of bytes in one scanline of the image"
+
+    |bitsPerRow bytesPerRow|
+
+    bitsPerRow := width * (self bitsPerPixel).
+    bytesPerRow := bitsPerRow // 8.
+    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
+        bytesPerRow := bytesPerRow + 1
+    ].
+    ^ bytesPerRow
+
+    "Created: 31.1.1997 / 10:39:06 / cg"
+!
+
 colorMap
     "return the colormap"
 
@@ -1601,5 +1622,5 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.37 1997-01-21 21:55:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.38 1997-01-31 09:52:18 cg Exp $'
 ! !
--- a/ImageReader.st	Wed Jan 29 20:59:32 1997 +0100
+++ b/ImageReader.st	Fri Jan 31 10:52:18 1997 +0100
@@ -1259,14 +1259,12 @@
      to a pipe for the uncompressor. Otherwise, return a stream to read
      the file directly."
 
-    |inStream name|
+    |inStream name fn|
 
     name := aFilename asString.
     ((name endsWith:'.Z') or:[name endsWith:'.gz']) ifTrue:[
-        inStream := PipeStream readingFrom:'gunzip < ' , name.
-        inStream isNil ifTrue:[
-            inStream := PipeStream readingFrom:'uncompress < ' , name.
-        ]
+        fn := Smalltalk getSystemFileName:name.
+        inStream := PipeStream readingFrom:'gunzip < ' , fn.
     ] ifFalse:[
         inStream := Smalltalk systemFileStreamFor:aFilename.
         inStream isNil ifTrue:[
@@ -1278,7 +1276,7 @@
     ].
     ^ inStream
 
-    "Modified: 10.1.1997 / 17:54:01 / cg"
+    "Modified: 31.1.1997 / 10:37:24 / cg"
 ! !
 
 !ImageReader class methodsFor:'image reading'!
@@ -1354,6 +1352,14 @@
     ^ (bitsPerSample inject:0 into:[:sum :i | sum + i])
 !
 
+bitsPerRow
+    "return the number of bits in one scanline of the image"
+
+    ^  width * (self bitsPerPixel).
+
+    "Created: 31.1.1997 / 10:38:42 / cg"
+!
+
 bitsPerSample
     "return the number of bits per sample"
 
@@ -1362,6 +1368,21 @@
     "Modified: 22.4.1996 / 19:15:18 / cg"
 !
 
+bytesPerRow
+    "return the number of bytes in one scanline of the image"
+
+    |bitsPerRow bytesPerRow|
+
+    bitsPerRow := width * (self bitsPerPixel).
+    bytesPerRow := bitsPerRow // 8.
+    ((bitsPerRow \\ 8) ~~ 0) ifTrue:[
+        bytesPerRow := bytesPerRow + 1
+    ].
+    ^ bytesPerRow
+
+    "Created: 31.1.1997 / 10:39:06 / cg"
+!
+
 colorMap
     "return the colormap"
 
@@ -1601,5 +1622,5 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.37 1997-01-21 21:55:28 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.38 1997-01-31 09:52:18 cg Exp $'
 ! !