refactorings
authorClaus Gittinger <cg@exept.de>
Fri, 04 Apr 2003 19:26:11 +0200
changeset 1739 971f1a3970a3
parent 1738 9c85e9d8326b
child 1740 b692ce36d2e3
refactorings
FaceReader.st
GIFReader.st
--- a/FaceReader.st	Fri Apr 04 19:18:18 2003 +0200
+++ b/FaceReader.st	Fri Apr 04 19:26:11 2003 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libview2' }"
+
 ImageReader subclass:#FaceReader
 	instanceVariableNames:''
 	classVariableNames:''
@@ -83,8 +85,8 @@
 
 !FaceReader methodsFor:'reading from file'!
 
-fromStream:aStream
-    "read an image in my format from aStream"
+readImage
+    "read an image in my format from my inStream"
 
     |line 
      dstIndex "{ Class: SmallInteger }"
@@ -94,9 +96,7 @@
      val      "{ Class: SmallInteger }"
      inHeader s depth|
 
-    inStream := aStream.
-
-    line := aStream nextLine.
+    line := inStream nextLine.
     line isNil ifTrue:[
         ^ self fileFormatError:'short read'.
     ].
@@ -111,7 +111,7 @@
             depth := Number readFrom:s.
             inHeader := false.
         ].
-        line := aStream nextLine
+        line := inStream nextLine
     ].
 
     depth == 8 ifFalse:[
@@ -119,7 +119,7 @@
     ].
 
     [line isEmpty] whileTrue:[
-        line := aStream nextLine.
+        line := inStream nextLine.
     ].
 
     bytesPerRow := width * depth // 8.
@@ -138,7 +138,7 @@
             data at:dstIndex put:val.
             dstIndex := dstIndex - 1
         ].
-        line := aStream nextLine
+        line := inStream nextLine
     ].
     photometric := #blackIs0.
     samplesPerPixel := 1.
@@ -155,6 +155,7 @@
 !FaceReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/FaceReader.st,v 1.25 1998-02-03 16:52:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/FaceReader.st,v 1.26 2003-04-04 17:26:11 cg Exp $'
 ! !
+
 FaceReader initialize!
--- a/GIFReader.st	Fri Apr 04 19:18:18 2003 +0200
+++ b/GIFReader.st	Fri Apr 04 19:26:11 2003 +0200
@@ -13,10 +13,9 @@
 "{ Package: 'stx:libview2' }"
 
 ImageReader subclass:#GIFReader
-	instanceVariableNames:'redMap greenMap blueMap pass xpos ypos rowByteSize remainBitCount
-		bufByte bufStream prefixTable suffixTable clearCode eoiCode
-		freeCode codeSize maxCode interlace frameDelay iterationCount
-		leftOffs topOffs'
+	instanceVariableNames:'pass xpos ypos rowByteSize remainBitCount bufByte bufStream
+		prefixTable suffixTable clearCode eoiCode freeCode codeSize
+		maxCode interlace frameDelay iterationCount leftOffs topOffs'
 	classVariableNames:'ImageSeparator Extension Terminator'
 	poolDictionaries:''
 	category:'Graphics-Images-Support'
@@ -293,25 +292,6 @@
 
 !GIFReader methodsFor:'reading from file'!
 
-checkGreyscaleColormap
-    "return true, if colormap is actually a greymap.
-     Could be used to convert it into a greyScale image - which is not yet done."
-
-    |sz "{ Class: SmallInteger }"
-     redVal|
-
-    sz := redMap size.
-
-    1 to:sz do:[:i |
-	redVal := redMap at:i.
-	redVal ~~ (greenMap at:i) ifTrue:[^ false].
-	redVal ~~ (blueMap at:i) ifTrue:[^ false].
-    ].
-    ^ true
-
-    "Modified: 2.5.1996 / 17:54:40 / cg"
-!
-
 fromStream:aStream
     "read a stream containing a GIF image (or an image sequence).
      Leave image description in instance variables."
@@ -370,11 +350,7 @@
 
     "get colorMap"
     hasColorMap ifTrue:[
-        self readColorMap:colorMapSize.
-        fileColorMap := Colormap 
-                        redVector:redMap 
-                        greenVector:greenMap 
-                        blueVector:blueMap.
+        fileColorMap := self readColorMap:colorMapSize.
     ].
     colorMap := fileColorMap.
 
@@ -483,7 +459,8 @@
 readColorMap:colorMapSize
     "get gif colormap consisting of colorMapSize entries"
 
-    |sz "{ Class: SmallInteger }"|
+    |sz "{ Class: SmallInteger }"
+     redMap greenMap blueMap|
 
     redMap := ByteArray uninitializedNew:colorMapSize.
     greenMap := ByteArray uninitializedNew:colorMapSize.
@@ -491,11 +468,16 @@
 
     sz := colorMapSize.
     1 to:sz do:[:i |
-	redMap at:i put:(inStream nextByte).
-	greenMap at:i put:(inStream nextByte).
-	blueMap at:i put:(inStream nextByte)
+        redMap at:i put:(inStream nextByte).
+        greenMap at:i put:(inStream nextByte).
+        blueMap at:i put:(inStream nextByte)
     ].
 
+    ^ Colormap 
+        redVector:redMap 
+        greenVector:greenMap 
+        blueVector:blueMap.
+
     "Modified: 21.6.1996 / 12:32:43 / cg"
 !
 
@@ -687,11 +669,7 @@
         bitsPerPixel := (flag bitAnd:2r00000111) + 1.
         colorMapSize := 1 bitShift:bitsPerPixel.
         "overwrite colormap"
-        self readColorMap:colorMapSize.
-        colorMap := Colormap 
-                        redVector:redMap 
-                        greenVector:greenMap 
-                        blueVector:blueMap.
+        colorMap := self readColorMap:colorMapSize.
     ].
 
 
@@ -1040,7 +1018,7 @@
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.79 2003-03-02 18:41:31 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.80 2003-04-04 17:25:46 cg Exp $'
 ! !
 
 GIFReader initialize!