Depth8Image.st
changeset 6837 e511316c0ed9
parent 6310 612c17181395
child 7276 3af688594d98
--- a/Depth8Image.st	Sat Mar 28 12:52:01 2015 +0100
+++ b/Depth8Image.st	Mon Apr 13 19:26:00 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 Image subclass:#Depth8Image
 	instanceVariableNames:''
 	classVariableNames:''
@@ -2314,25 +2318,25 @@
      in those from the dithercolors"
 
     1 to:nColors do:[:i |
-	clr := (map at:i) onDevice:aDevice.
-	ditherPattern := clr ditherForm.
+        clr := (map at:i) onDevice:aDevice.
+        ditherPattern := clr ditherForm.
 
-	ditherPattern isNil ifTrue:[
-	    patterns at:i put:#[2r11111111
-				2r11111111
-				2r11111111
-				2r11111111
-				2r11111111
-				2r11111111
-				2r11111111
-				2r11111111].
-	    pixel0bytes at:i put:clr colorId.
-	    pixel1bytes at:i put:clr colorId
-	] ifFalse:[
-	    patterns at:i put:(ditherPattern bits).
-	    pixel0bytes at:i put:(ditherPattern colorMap at:1) colorId.
-	    pixel1bytes at:i put:(ditherPattern colorMap at:2) colorId.
-	].
+        ditherPattern isNil ifTrue:[
+            patterns at:i put:#[2r11111111
+                                2r11111111
+                                2r11111111
+                                2r11111111
+                                2r11111111
+                                2r11111111
+                                2r11111111
+                                2r11111111].
+            pixel0bytes at:i put:clr colorId.
+            pixel1bytes at:i put:clr colorId
+        ] ifFalse:[
+            patterns at:i put:(ditherPattern bits).
+            pixel0bytes at:i put:(ditherPattern colorMap at:1) colorId.
+            pixel1bytes at:i put:(ditherPattern colorMap at:2) colorId.
+        ].
     ].
 
 %{
@@ -2348,62 +2352,62 @@
     _srcP = __ByteArrayInstPtr(__INST(bytes))->ba_element;
     _dstP = __ByteArrayInstPtr(formBytes)->ba_element;
     for (_h = __intVal(h); _h; _h--) {
-	_last = -1;
-	_outCount = 0;
-	for (_w = __intVal(w); _w; _w--) {
-	    _v = *_srcP++;
-	    if (_v != _last) {
-		_patternBytes = __ArrayInstPtr(patterns)->a_element[_v];
-		if (__isByteArray(_patternBytes)) {
-		    _patternBits = __ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset];
-		} else if (__isArrayLike(_patternBytes)) {
-		    _patternBits = __intVal(__ArrayInstPtr(_patternBytes)->a_element[_patternOffset]);
-		}
-		_p0 = __ByteArrayInstPtr(pixel0bytes)->ba_element[_v];
-		_p1 = __ByteArrayInstPtr(pixel1bytes)->ba_element[_v];
-		_last = _v;
-	    }
-	    _outBits <<= 2;
-	    if (_patternBits & __mask)
-		_outBits |= _p1;
-	    else
-		_outBits |= _p0;
-	    __mask >>= 1;
-	    _outCount++;
-	    if (_outCount == 4) {
-		*_dstP++ = _outBits;
-		_outCount = 0;
-		if (__mask == 0) {
-		    __mask = 0x80;
-		}
-	    }
-	}
-	if (_outCount) {
-	    do {
-		_outBits <<= 2;
-	    } while (++_outCount != 4);
-	    *_dstP++ = _outBits;
-	}
-	__mask = 0x80;
-	_outBits = 0;
-	_patternOffset++;
-	if (_patternOffset == 8)
-	    _patternOffset = 0;
+        _last = -1;
+        _outCount = 0;
+        for (_w = __intVal(w); _w; _w--) {
+            _v = *_srcP++;
+            if (_v != _last) {
+                _patternBytes = __ArrayInstPtr(patterns)->a_element[_v];
+                if (__isByteArray(_patternBytes)) {
+                    _patternBits = __ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset];
+                } else if (__isArrayLike(_patternBytes)) {
+                    _patternBits = __intVal(__ArrayInstPtr(_patternBytes)->a_element[_patternOffset]);
+                }
+                _p0 = __ByteArrayInstPtr(pixel0bytes)->ba_element[_v];
+                _p1 = __ByteArrayInstPtr(pixel1bytes)->ba_element[_v];
+                _last = _v;
+            }
+            _outBits <<= 2;
+            if (_patternBits & __mask)
+                _outBits |= _p1;
+            else
+                _outBits |= _p0;
+            __mask >>= 1;
+            _outCount++;
+            if (_outCount == 4) {
+                *_dstP++ = _outBits;
+                _outCount = 0;
+                if (__mask == 0) {
+                    __mask = 0x80;
+                }
+            }
+        }
+        if (_outCount) {
+            do {
+                _outBits <<= 2;
+            } while (++_outCount != 4);
+            *_dstP++ = _outBits;
+        }
+        __mask = 0x80;
+        _outBits = 0;
+        _patternOffset++;
+        if (_patternOffset == 8)
+            _patternOffset = 0;
     }
 %}
 .
-    f := Form width:w height:h depth:2.
+    f := Form width:w height:h depth:2 onDevice:aDevice.
     f initGC.
     f graphicsDevice
-	drawBits:formBytes
-	depth:2
-	padding:8
-	width:w height:h
-	x:0 y:0
-	into:f id
-	x:0 y:0
-	width:w height:h
-	with:f gcId.
+        drawBits:formBytes
+        depth:2
+        padding:8
+        width:w height:h
+        x:0 y:0
+        into:f id
+        x:0 y:0
+        width:w height:h
+        with:f gcId.
     ^ f
 ! !
 
@@ -2460,10 +2464,10 @@
 !Depth8Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.122 2014-03-05 15:26:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.123 2015-04-13 17:26:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.122 2014-03-05 15:26:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.123 2015-04-13 17:26:00 cg Exp $'
 ! !