WindowsIconReader.st
changeset 211 3eb140e89e2e
parent 172 ee7d84977c86
child 234 b6352d13e792
--- a/WindowsIconReader.st	Tue Apr 23 13:06:56 1996 +0200
+++ b/WindowsIconReader.st	Tue Apr 23 13:12:01 1996 +0200
@@ -37,14 +37,29 @@
 "
     this class provides methods for loading Windows and OS2 icon files.
     Image writing is not supported.
+
+    The reader tries to figure out which version of BMP/ICO is used.
+    It seems to be able to load most formats, but who knows ...
+
+    [See also:]
+        BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
+        ST80FormReader SunRasterReader TargaReader TIFFReader  
+        XBMReader XPMReader XWDReader 
 "
 ! !
 
 !WindowsIconReader class methodsFor:'initialization'!
 
 initialize
+    "tell Image-class, that a new fileReader is present
+     for the '.bmp', '.BMP', '.ico' and '.ICO' extensions."
+
     Image fileFormats at:'.bmp'  put:self.
+    Image fileFormats at:'.BMP'  put:self.
     Image fileFormats at:'.ico'  put:self.
+    Image fileFormats at:'.ICO'  put:self.
+
+    "Modified: 23.4.1996 / 13:08:46 / cg"
 ! !
 
 !WindowsIconReader class methodsFor:'testing'!
@@ -97,6 +112,8 @@
 !WindowsIconReader methodsFor:'private'!
 
 loadBMPWidth:w height:h depth:d compression:c from:aStream into:data
+    "helper: load a BMP image"
+
     |buff idx1 idx2 bytesPerRow|
 
     d == 8 ifTrue:[
@@ -150,12 +167,14 @@
     'BMP: unsupported depth:' infoPrint. d infoPrintNL.
 
     "Created: 17.9.1995 / 18:48:11 / claus"
-    "Modified: 4.2.1996 / 18:04:44 / cg"
+    "Modified: 23.4.1996 / 13:09:09 / cg"
 ! !
 
 !WindowsIconReader methodsFor:'reading from file'!
 
-fromOS2File: aFilename 
+fromOS2File:aFilename
+    "read an image from an OS/2 BMP file"
+
     |reader stream|
 
     stream := self streamReadingFile:aFilename.
@@ -164,9 +183,13 @@
     stream close.
     reader notNil ifTrue:[^ reader image].
     ^ nil
+
+    "Modified: 23.4.1996 / 13:09:28 / cg"
 !
 
 fromOS2Stream:aStream
+    "read an image from an OS/2 BMP stream"
+
     | header inDepth
       rawMap rMap gMap bMap srcIndex dstIndex inBytesPerRow
       data4 mask tmp bytesPerRow nColors nByte|
@@ -270,10 +293,15 @@
     "
 
     "Modified: 17.9.1995 / 18:49:24 / claus"
+    "Modified: 23.4.1996 / 13:09:40 / cg"
 !
 
 fromStream:aStream 
-    | fileSize header |
+    "figure out which format the stream contains
+     (there are various different bmp/ico formats around)
+     and read the image."
+
+    |fileSize header|
 
     inStream := aStream.
 
@@ -331,9 +359,12 @@
     "
 
     "Modified: 17.9.1995 / 18:59:07 / claus"
+    "Modified: 23.4.1996 / 13:11:10 / cg"
 !
 
 fromWindowsBMPFile: aFilename 
+    "read an image from a windows BMP file"
+
     |reader stream|
 
     stream := self class streamReadingFile:aFilename.
@@ -342,9 +373,13 @@
     stream close.
     reader notNil ifTrue:[^ reader image].
     ^ nil
+
+    "Modified: 23.4.1996 / 13:09:53 / cg"
 !
 
 fromWindowsBMPStream:aStream 
+    "read an image from a windows BMP stream"
+
     | fileSize header inDepth inPlanes compression
       imgSize resH resV numColor numImportantColor
       dataStart
@@ -493,10 +528,12 @@
     colorMap := Colormap redVector:rMap greenVector:gMap blueVector:bMap.
 
     "Modified: 17.9.1995 / 18:48:46 / claus"
-    "Modified: 4.2.1996 / 17:57:50 / cg"
+    "Modified: 23.4.1996 / 13:10:00 / cg"
 !
 
-fromWindowsICOFile: aFilename 
+fromWindowsICOFile:aFilename 
+    "read an image from a windows ICO file"
+
     |reader stream|
 
     stream := self class streamReadingFile:aFilename.
@@ -509,9 +546,13 @@
     "
      Image fromFile:'/phys/clam2//LocalLibrary/Images/WIN_icons/ibm.ico'.
     "
+
+    "Modified: 23.4.1996 / 13:10:11 / cg"
 !
 
 fromWindowsICOStream:aStream
+    "read an image from a windows ICO stream"
+
     | header inDepth
       rawMap rMap gMap bMap srcIndex dstIndex
       data4 mask tmp bytesPerRow nColor|
@@ -591,11 +632,13 @@
     "
      WindowsIconReader new fromWindowsICOFile:'/phys/clam2//LocalLibrary/Images/WIN_icons/ibm.ico'.
     "
+
+    "Modified: 23.4.1996 / 13:10:18 / cg"
 ! !
 
 !WindowsIconReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.22 1996-03-07 18:28:20 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.23 1996-04-23 11:12:01 cg Exp $'
 ! !
 WindowsIconReader initialize!