commentary
authorClaus Gittinger <cg@exept.de>
Mon, 22 Apr 1996 19:38:28 +0200
changeset 583 211abfdb4db5
parent 582 dbb1d19a1065
child 584 6106ad13708d
commentary
ImageRdr.st
ImageReader.st
--- a/ImageRdr.st	Mon Apr 22 17:59:20 1996 +0200
+++ b/ImageRdr.st	Mon Apr 22 19:38:28 1996 +0200
@@ -1133,6 +1133,9 @@
 !
 
 loadBMP1to8Width:width height:height from:aStream into:aByteArray
+    "load bmp-1 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1140,18 +1143,23 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP1to8(__intVal(width), __intVal(height), 
-		 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+                 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:32 / cg"
 !
 
 loadBMP2to8Width:width height:height from:aStream into:aByteArray
+    "load bmp-2 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1159,18 +1167,23 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP2to8(__intVal(width), __intVal(height), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:40 / cg"
 !
 
 loadBMP4to8Width:width height:height compression:compression from:aStream into:aByteArray
+    "load bmp-4 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1178,36 +1191,43 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isSmallInteger(compression)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isSmallInteger(compression)
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:46 / cg"
 !
 
 loadBMP8Width:width height:height compression:compression from:aStream into:aByteArray
-    |f|
+    "load bmp-8 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
+|f|
 
     aStream isExternalStream ifFalse:[^ false].
     f := aStream filePointer.
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isSmallInteger(compression)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isSmallInteger(compression)
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:54 / cg"
 ! !
 
 !ImageReader class methodsFor:'i/o support'!
@@ -1266,15 +1286,18 @@
 !
 
 fromStream:aStream
-    "read an image (in my format) from aStream"
+    "read an image (in my format) from aStream.
+     Return the image or nil (if unrecognized format or error)"
 
     |reader|
 
     reader := self new fromStream:aStream.
     reader notNil ifTrue:[
-	^ reader image
+        ^ reader image
     ].
     ^ nil
+
+    "Modified: 22.4.1996 / 19:11:58 / cg"
 ! !
 
 !ImageReader class methodsFor:'image writing'!
@@ -1311,23 +1334,39 @@
 !
 
 bitsPerSample
+    "return the number of bits per sample"
+
     ^ bitsPerSample
+
+    "Modified: 22.4.1996 / 19:15:18 / cg"
 !
 
 colorMap
+    "return the colormap"
+
     ^ colorMap
+
+    "Modified: 22.4.1996 / 19:15:24 / cg"
 !
 
 data 
+    "return the raw image data"
+
     ^ data
+
+    "Modified: 22.4.1996 / 19:15:31 / cg"
 !
 
 height 
+    "return the height of the image"
+
     ^ height
+
+    "Modified: 22.4.1996 / 19:15:39 / cg"
 !
 
 image
-    "return the image represented by myself"
+    "return the image as represented by myself"
 
     |image depth|
 
@@ -1341,18 +1380,32 @@
     image colorMap:colorMap.
     image data:data.
     ^ image
+
+    "Modified: 22.4.1996 / 19:15:46 / cg"
 !
 
 photometric
+    "return the photometric interpretation of the image data"
+
     ^ photometric
+
+    "Modified: 22.4.1996 / 19:15:57 / cg"
 !
 
 samplesPerPixel
+    "return the number of samples per pixel"
+
     ^ samplesPerPixel
+
+    "Modified: 22.4.1996 / 19:16:03 / cg"
 !
 
 width
+    "return the width of the image"
+
     ^ width
+
+    "Modified: 22.4.1996 / 19:16:10 / cg"
 ! !
 
 !ImageReader methodsFor:'i/o support'!
@@ -1402,9 +1455,13 @@
 !ImageReader methodsFor:'image reading'!
 
 fromStream:aStream
-    "read imagedata in my format from aStream"
+    "read an image in my format from aStream.
+     Leave image description in instance variables."
+
 
     ^ self subclassResponsibility
+
+    "Modified: 22.4.1996 / 19:11:31 / cg"
 ! !
 
 !ImageReader methodsFor:'image writing'!
@@ -1418,5 +1475,5 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.25 1996-03-07 18:36:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/ImageRdr.st,v 1.26 1996-04-22 17:38:28 cg Exp $'
 ! !
--- a/ImageReader.st	Mon Apr 22 17:59:20 1996 +0200
+++ b/ImageReader.st	Mon Apr 22 19:38:28 1996 +0200
@@ -1133,6 +1133,9 @@
 !
 
 loadBMP1to8Width:width height:height from:aStream into:aByteArray
+    "load bmp-1 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1140,18 +1143,23 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP1to8(__intVal(width), __intVal(height), 
-		 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+                 __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:32 / cg"
 !
 
 loadBMP2to8Width:width height:height from:aStream into:aByteArray
+    "load bmp-2 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1159,18 +1167,23 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP2to8(__intVal(width), __intVal(height), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:40 / cg"
 !
 
 loadBMP4to8Width:width height:height compression:compression from:aStream into:aByteArray
+    "load bmp-4 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
     |f|
 
     aStream isExternalStream ifFalse:[^ false].
@@ -1178,36 +1191,43 @@
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isSmallInteger(compression)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isSmallInteger(compression)
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP4to8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:46 / cg"
 !
 
 loadBMP8Width:width height:height compression:compression from:aStream into:aByteArray
-    |f|
+    "load bmp-8 bit per pixel imagedata. A helper for BMP image reader.
+     Calls primitive c function for speed"
+
+|f|
 
     aStream isExternalStream ifFalse:[^ false].
     f := aStream filePointer.
     f isNil ifTrue:[^ false].
 %{
     if (! (__bothSmallInteger(width, height)
-	   && __isSmallInteger(compression)
-	   && __isByteArray(aByteArray))) {
-	RETURN (false);
+           && __isSmallInteger(compression)
+           && __isByteArray(aByteArray))) {
+        RETURN (false);
     }
     if (loadBMP8(__intVal(width), __intVal(height), __intVal(compression), 
-	     __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
-	RETURN (true);
+             __FILEVal(f), __ByteArrayInstPtr(aByteArray)->ba_element)) {
+        RETURN (true);
     }
     RETURN (false);
 %}
+
+    "Modified: 22.4.1996 / 19:14:54 / cg"
 ! !
 
 !ImageReader class methodsFor:'i/o support'!
@@ -1266,15 +1286,18 @@
 !
 
 fromStream:aStream
-    "read an image (in my format) from aStream"
+    "read an image (in my format) from aStream.
+     Return the image or nil (if unrecognized format or error)"
 
     |reader|
 
     reader := self new fromStream:aStream.
     reader notNil ifTrue:[
-	^ reader image
+        ^ reader image
     ].
     ^ nil
+
+    "Modified: 22.4.1996 / 19:11:58 / cg"
 ! !
 
 !ImageReader class methodsFor:'image writing'!
@@ -1311,23 +1334,39 @@
 !
 
 bitsPerSample
+    "return the number of bits per sample"
+
     ^ bitsPerSample
+
+    "Modified: 22.4.1996 / 19:15:18 / cg"
 !
 
 colorMap
+    "return the colormap"
+
     ^ colorMap
+
+    "Modified: 22.4.1996 / 19:15:24 / cg"
 !
 
 data 
+    "return the raw image data"
+
     ^ data
+
+    "Modified: 22.4.1996 / 19:15:31 / cg"
 !
 
 height 
+    "return the height of the image"
+
     ^ height
+
+    "Modified: 22.4.1996 / 19:15:39 / cg"
 !
 
 image
-    "return the image represented by myself"
+    "return the image as represented by myself"
 
     |image depth|
 
@@ -1341,18 +1380,32 @@
     image colorMap:colorMap.
     image data:data.
     ^ image
+
+    "Modified: 22.4.1996 / 19:15:46 / cg"
 !
 
 photometric
+    "return the photometric interpretation of the image data"
+
     ^ photometric
+
+    "Modified: 22.4.1996 / 19:15:57 / cg"
 !
 
 samplesPerPixel
+    "return the number of samples per pixel"
+
     ^ samplesPerPixel
+
+    "Modified: 22.4.1996 / 19:16:03 / cg"
 !
 
 width
+    "return the width of the image"
+
     ^ width
+
+    "Modified: 22.4.1996 / 19:16:10 / cg"
 ! !
 
 !ImageReader methodsFor:'i/o support'!
@@ -1402,9 +1455,13 @@
 !ImageReader methodsFor:'image reading'!
 
 fromStream:aStream
-    "read imagedata in my format from aStream"
+    "read an image in my format from aStream.
+     Leave image description in instance variables."
+
 
     ^ self subclassResponsibility
+
+    "Modified: 22.4.1996 / 19:11:31 / cg"
 ! !
 
 !ImageReader methodsFor:'image writing'!
@@ -1418,5 +1475,5 @@
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.25 1996-03-07 18:36:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.26 1996-04-22 17:38:28 cg Exp $'
 ! !