tuned rowAt:putAll
authortz
Thu, 23 Jul 1998 16:32:45 +0200
changeset 2180 c6b09d67eb40
parent 2179 30461fd19cd5
child 2181 7b07c4a6cad4
tuned rowAt:putAll
Depth16Image.st
--- a/Depth16Image.st	Thu Jul 23 16:32:08 1998 +0200
+++ b/Depth16Image.st	Thu Jul 23 16:32:45 1998 +0200
@@ -90,6 +90,27 @@
     bytes wordAt:(lineIndex + (x * 2)) put:aPixelValue MSB:true
 
     "Created: 24.4.1997 / 17:06:21 / cg"
+!
+
+rowAt:rowIndex putAll:pixelArray startingAt:startIndex
+    "store a single rows bits from bits in the pixelArray argument;
+     Return the pixelArray.
+     Notice: row indexing starts at 0."
+
+    |dstIdx "{ Class: SmallInteger }"
+      pixel|
+
+    dstIdx := (width * 2 * rowIndex) + 1.
+    1 to:width do:[:col |
+        pixel := pixelArray at:(startIndex + col - 1).
+        bytes at:dstIdx put:((pixel bitShift:-8) bitAnd:16rFF).
+        bytes at:dstIdx+1 put:(pixel bitAnd:16rFF).
+        dstIdx := dstIdx + 2.
+    ].
+    ^ pixelArray
+
+    "Created: 24.4.1997 / 15:50:27 / cg"
+
 ! !
 
 !Depth16Image methodsFor:'queries'!
@@ -115,5 +136,5 @@
 !Depth16Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.7 1997-04-24 16:03:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.8 1998-07-23 14:32:45 tz Exp $'
 ! !