--- a/Depth24Image.st Tue Aug 30 18:53:27 2016 +0200
+++ b/Depth24Image.st Wed Aug 31 10:57:46 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -2680,6 +2682,52 @@
]
"Created: 7.6.1996 / 19:09:40 / cg"
+!
+
+valuesFromX:xStart y:yStart toX:xEnd y:yEnd do:aBlock
+ "perform aBlock for each pixel in the rectangle
+ yStart..yEnd / xStart..xEnd.
+ The block is passed the pixelValue at each pixel.
+ This method allows slighly faster processing of an
+ image than using individual valueAtX:y: accesses,
+ since some processing can be avoided when going from pixel to pixel..
+ However, for real high performance image processing, specialized methods
+ should be written which know how to deal with specific photometric interpretations."
+
+ |srcIndex "{ Class: SmallInteger }"
+ srcNext "{ Class: SmallInteger }"
+ bytesPerRow "{ Class: SmallInteger }"
+ value "{ Class: SmallInteger }"
+ x1 "{ Class: SmallInteger }"
+ x2 "{ Class: SmallInteger }"
+ y1 "{ Class: SmallInteger }"
+ y2 "{ Class: SmallInteger }"
+ bytes|
+
+ x1 := xStart.
+ x2 := xEnd.
+ y1 := yStart.
+ y2 := yEnd.
+
+ srcIndex := (width * 3 * y1) + (x1 * 3) + 1 .
+ bytesPerRow := self bytesPerRow.
+ bytes := self bits.
+
+ y1 to:y2 do:[:y |
+ srcNext := srcIndex + bytesPerRow.
+ x1 to:x2 do:[:x |
+ value := bytes at:srcIndex.
+ value := (value bitShift:8) + (bytes at:srcIndex+1).
+ value := (value bitShift:8) + (bytes at:srcIndex+2).
+ srcIndex := srcIndex + 3.
+
+ aBlock value:x value:y value:value
+ ].
+ srcIndex := srcNext.
+ ].
+
+ "Modified: 11.7.1996 / 20:06:47 / cg"
+ "Created: 11.7.1996 / 20:08:11 / cg"
! !
!Depth24Image methodsFor:'image manipulations'!