--- a/Depth24Image.st Thu Dec 18 01:11:55 2008 +0100
+++ b/Depth24Image.st Mon Dec 22 15:33:07 2008 +0100
@@ -2506,6 +2506,49 @@
!Depth24Image methodsFor:'enumerating'!
+colorsAtX:x from:yLow to:yHigh do:aBlock
+ "perform aBlock for each pixel from y1 to y2 in col x.
+ The block is passed the color at each pixel.
+ This method allows slighly faster processing of an
+ image than using atX:y:, since some processing can be
+ avoided when going from pixel to pixel. However, for
+ real image processing, specialized methods should be written."
+
+ |srcIndex "{ Class: SmallInteger }"
+ y1 "{ Class: SmallInteger }"
+ y2 "{ Class: SmallInteger }"
+ rVal "{ Class: SmallInteger }"
+ gVal "{ Class: SmallInteger }"
+ bVal "{ Class: SmallInteger }"
+ lastR lastG lastB lastColor bytes|
+
+ photometric ~~ #rgb ifTrue:[
+ ^ super colorsAtX:x from:yLow to:yHigh do:aBlock.
+ ].
+
+ bytes := self bits.
+
+ y1 := yLow.
+ y2 := yHigh.
+
+ srcIndex := 1 + (((width * yLow) + x) * 3).
+
+ y1 to:y2 do:[:y |
+ rVal := bytes at:(srcIndex).
+ gVal := bytes at:(srcIndex + 1).
+ bVal := bytes at:(srcIndex + 2).
+ srcIndex := srcIndex + width.
+
+ (rVal == lastR and:[gVal == lastG and:[bVal == lastB]]) ifFalse:[
+ lastColor := Color redByte:rVal greenByte:gVal blueByte:bVal.
+ lastR := rVal.
+ lastG := gVal.
+ lastB := bVal.
+ ].
+ aBlock value:y value:lastColor
+ ]
+!
+
colorsAtY:y from:xLow to:xHigh do:aBlock
"perform aBlock for each pixel from x1 to x2 in row y.
The block is passed the color at each pixel.
@@ -3064,5 +3107,5 @@
!Depth24Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.89 2007-10-30 19:58:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.90 2008-12-22 14:33:07 cg Exp $'
! !