Depth4Image.st
changeset 1816 88716b7cc777
parent 1812 beeaf75b245b
child 2042 58c0228331bb
--- a/Depth4Image.st	Mon Jul 21 17:34:59 1997 +0200
+++ b/Depth4Image.st	Mon Jul 21 18:07:37 1997 +0200
@@ -137,6 +137,34 @@
     bytes at:index put:byte
 
     "Created: 24.4.1997 / 17:06:39 / cg"
+!
+
+rowAt:rowIndex into:aPixelBuffer
+    "fill aBuffer with pixel values retrieved from a single row.
+     Notice: rowIndex is 0-based."
+
+    |lineIndex "{ Class: SmallInteger }"
+     byte      "{ Class: SmallInteger }" 
+     w         "{ Class: SmallInteger }" 
+     pixel dstIdx|
+
+    dstIdx := 1.
+    w := width - 1.
+    lineIndex := (self bytesPerRow * rowIndex).
+    0 to:w do:[:x |
+        x even ifTrue:[
+            lineIndex := lineIndex + 1.
+            byte := bytes at:lineIndex.
+            pixel := (byte bitShift:-4) bitAnd:16rF.
+        ] ifFalse:[
+            pixel := byte bitAnd:16rF.
+        ].
+        aPixelBuffer at:dstIdx put:pixel.
+        dstIdx := dstIdx + 1
+    ].
+
+    "Created: 21.7.1997 / 18:04:00 / cg"
+    "Modified: 21.7.1997 / 18:05:47 / cg"
 ! !
 
 !Depth4Image methodsFor:'dither helpers'!
@@ -637,5 +665,5 @@
 !Depth4Image class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.25 1997-07-18 22:41:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.26 1997-07-21 16:07:37 cg Exp $'
 ! !