ImageReader.st
changeset 4033 9af502584519
parent 3965 8c9c9e08880c
child 4055 bb45fa7310eb
--- a/ImageReader.st	Tue Feb 24 11:31:53 2004 +0100
+++ b/ImageReader.st	Tue Feb 24 11:35:25 2004 +0100
@@ -1550,28 +1550,28 @@
 
 %{  /* OPTIONAL */
     if (__isByteArray(data) && __isSmallInteger(nBytes)) {
-        int __nBytes = __intVal(nBytes);
-        int __dataSize = __byteArraySize(data);
+	int __nBytes = __intVal(nBytes);
+	int __dataSize = __byteArraySize(data);
 
-        if (__nBytes <= __dataSize) {
-            int __lastIndex = __nBytes - 2;
-            unsigned char *__cp = __ByteArrayInstPtr(data)->ba_element;
-            int __i;
-            unsigned char __t;
+	if (__nBytes <= __dataSize) {
+	    int __lastIndex = __nBytes - 2;
+	    unsigned char *__cp = __ByteArrayInstPtr(data)->ba_element;
+	    int __i;
+	    unsigned char __t;
 
-            for (__i=0; __i<__lastIndex; __i+=3, __cp+=3) {
-                __t = __cp[0];
-                __cp[0] = __cp[2];
-                __cp[2] = __t;
-            }
-            RETURN (true);
-        }
+	    for (__i=0; __i<__lastIndex; __i+=3, __cp+=3) {
+		__t = __cp[0];
+		__cp[0] = __cp[2];
+		__cp[2] = __t;
+	    }
+	    RETURN (true);
+	}
     }
 %}.
     1 to:(nBytes - 2) by:3 do:[:i |
-        t := data at:i.
-        data at:i put:(data at:i+2).
-        data at:i+2 put:t
+	t := data at:i.
+	data at:i put:(data at:i+2).
+	data at:i+2 put:t
     ].
 
     "
@@ -1587,7 +1587,7 @@
      bytes := ByteArray new:1000000.
      bytes replaceFrom:1 with:#[ 0 1 2 3 4 5 6 7 8 9 10 11 12].   
      Time millisecondsToRun:[
-        self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
+	self swap:1000000 bytesFromRGB_to_BGR_in:bytes.
      ].    
      bytes copyTo:10. 
     "
@@ -1637,8 +1637,8 @@
 
     "
      XBMReader fromFile:'bitmaps/SBrowser.xbm'
-     XPMReader fromFile:'bitmaps/xpmBitmaps/BOOK.xpm'
-     XBMReader fromFile:'bitmaps/xpmBitmaps/BOOK.xpm'
+     XPMReader fromFile:'bitmaps/xpmBitmaps/misc_icons/BOOK.xpm'
+     XBMReader fromFile:'bitmaps/xpmBitmaps/misc_icons/BOOK.xpm'
     "
 
     "Modified: 4.4.1997 / 22:09:49 / cg"
@@ -1695,20 +1695,20 @@
 
     inStream := self streamReadingFile:aFileName.
     inStream isNil ifTrue:[
-        'ImageReader [warning]: file open error' errorPrintCR.
-        ^ nil
+	'ImageReader [warning]: file open error' errorPrintCR.
+	^ nil
     ].
     reader := self new.
     reader inStream:inStream.
     [
-        reader fromStream:inStream.
+	reader fromStream:inStream.
     ] ensure:[
-        inStream close.
+	inStream close.
     ].
     ^ reader
 
     "
-     XPMReader readFile:'bitmaps/xpmBitmaps/BOOK.xpm'
+     XPMReader readFile:'bitmaps/xpmBitmaps/misc_icons/BOOK.xpm'
     "
 
     "Modified: 4.4.1997 / 22:06:49 / cg"
@@ -1815,7 +1815,7 @@
 #ifdef DEBUG
 	    if (__outP >= outEnd) {
 		fprintf(stderr, "oops2 %d\n", __LINE__);
-	        goto fail;
+		goto fail;
 	    }
 #endif
 	    *__outP = __outBits;
@@ -1994,24 +1994,24 @@
 
     depth := self bitsPerPixel.
     (depth notNil and:[data notNil]) ifTrue:[
-        image := Image newForDepth:depth.
-        image depth:depth.
-        inStream isFileStream ifTrue:[
-            image fileName:inStream pathName.
-        ].
-        image 
-            width:width 
-            height:height
-            photometric:photometric
-            samplesPerPixel:samplesPerPixel
-            bitsPerSample:bitsPerSample
-            colorMap:colorMap
-            bits:data
-            mask:mask.
+	image := Image newForDepth:depth.
+	image depth:depth.
+	inStream isFileStream ifTrue:[
+	    image fileName:inStream pathName.
+	].
+	image 
+	    width:width 
+	    height:height
+	    photometric:photometric
+	    samplesPerPixel:samplesPerPixel
+	    bitsPerSample:bitsPerSample
+	    colorMap:colorMap
+	    bits:data
+	    mask:mask.
 
-        imageSequence notNil ifTrue:[
-            image imageSequence:imageSequence.
-        ].
+	imageSequence notNil ifTrue:[
+	    image imageSequence:imageSequence.
+	].
     ].
     ^ image
 
@@ -2190,22 +2190,22 @@
     |stream|
 
     [
-        stream := aFileName asFilename newReadWriteStream.
+	stream := aFileName asFilename newReadWriteStream.
     ] on:FileStream openErrorSignal do:[:ex|
-        ^ Image fileCreationErrorSignal 
-            raiseWith:image
-            errorString:('file creation error: ' , aFileName asString).
+	^ Image fileCreationErrorSignal 
+	    raiseWith:image
+	    errorString:('file creation error: ' , aFileName asString).
     ].
 
     [
-        [
-            self save:image onStream:stream.
-        ] ifCurtailed:[
-            aFileName asFilename delete.
-        ].
+	[
+	    self save:image onStream:stream.
+	] ifCurtailed:[
+	    aFileName asFilename delete.
+	].
 
     ] ensure:[
-        stream close.
+	stream close.
     ].
 !
 
@@ -2213,8 +2213,8 @@
     "save image in my format on a Stream"
 
     ^ Image cannotRepresentImageSignal 
-        raiseWith:image
-        errorString:('image save not implemented for this format').
+	raiseWith:image
+	errorString:('image save not implemented for this format').
 ! !
 
 !ImageReader methodsFor:'initialization'!
@@ -2256,10 +2256,10 @@
 
 reportDimension
     dimensionCallBack notNil ifTrue:[
-        dimensionCallBack value:self
+	dimensionCallBack value:self
     ].
     dimensionHolder notNil ifTrue:[
-        dimensionHolder value:(width @ height)
+	dimensionHolder value:(width @ height)
     ].
 !
 
@@ -2267,12 +2267,12 @@
     "can be used by a GUI application to indicate loading progress (0..1)"
 
     progressHolder notNil ifTrue:[
-        progressHolder value:fraction
+	progressHolder value:fraction
     ].
 ! !
 
 !ImageReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.86 2003-11-26 22:14:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ImageReader.st,v 1.87 2004-02-24 10:35:25 cg Exp $'
 ! !