--- a/Depth1Image.st Tue Aug 29 15:39:46 2017 +0200
+++ b/Depth1Image.st Tue Aug 29 15:39:47 2017 +0200
@@ -117,11 +117,11 @@
!
pixelAtX:x y:y put:aPixelValue
- "set a pixels value at x/y to aPixelValue.
+ "set a pixel's value at x/y to aPixelValue.
The interpretation of the pixelValue depends on the photometric
and the colormap. (see also: Image>>atX:y:put:)
- Pixels start at x=0 , y=0 for upper left pixel, end at
- x = width-1, y=height-1 for lower right pixel"
+ Pixels start at x=0 , y=0 for the upper left pixel,
+ and end at x = width-1, y=height-1 for the lower right pixel"
|index "{Class: SmallInteger}"
byte "{Class: SmallInteger}"
@@ -162,6 +162,8 @@
byte := byte bitOr:mask
].
bytes at:index put:byte
+
+ "Modified (comment): / 29-08-2017 / 14:35:47 / cg"
! !
!Depth1Image methodsFor:'converting'!
@@ -305,7 +307,15 @@
!
valuesAtY:y from:xLow to:xHigh do:aBlock
- "perform aBlock for each pixelValue from x1 to x2 in row y.
+ "WARNING: this enumerates pixel values which need photometric interpretation
+ Do not confuse with #rgbValuesAtY:from:to:do:
+
+ Perform aBlock for each pixelValue from x1 to x2 in row y.
+
+ Notice the difference between rgbValue and pixelValue: rgbValues are always
+ the rgb bytes; pixelvalues depend on the photometric interpretation, and may be
+ indices into a colormap or be non-byte-sized rgb values.
+
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
@@ -332,34 +342,35 @@
srcIndex := srcIndex + (x1 // 8).
mask := #[2r10000000
- 2r01000000
- 2r00100000
- 2r00010000
- 2r00001000
- 2r00000100
- 2r00000010
- 2r00000001] at:((x1 \\ 8) + 1).
+ 2r01000000
+ 2r00100000
+ 2r00010000
+ 2r00001000
+ 2r00000100
+ 2r00000010
+ 2r00000001] at:((x1 \\ 8) + 1).
byte := bytes at:srcIndex.
x1 to:x2 do:[:x |
- (byte bitAnd:mask) == 0 ifTrue:[
- aBlock value:x value:0
- ] ifFalse:[
- aBlock value:x value:1
- ].
+ (byte bitAnd:mask) == 0 ifTrue:[
+ aBlock value:x value:0
+ ] ifFalse:[
+ aBlock value:x value:1
+ ].
- mask := mask bitShift:-1.
- mask == 0 ifTrue:[
- mask := 2r10000000.
- srcIndex := srcIndex + 1.
- x < x2 ifTrue:[
- byte := bytes at:srcIndex.
- ]
- ]
+ mask := mask bitShift:-1.
+ mask == 0 ifTrue:[
+ mask := 2r10000000.
+ srcIndex := srcIndex + 1.
+ x < x2 ifTrue:[
+ byte := bytes at:srcIndex.
+ ]
+ ]
]
- "Created: 7.6.1996 / 19:09:38 / cg"
- "Modified: 8.6.1996 / 13:36:37 / cg"
+ "Created: / 07-06-1996 / 19:09:38 / cg"
+ "Modified: / 08-06-1996 / 13:36:37 / cg"
+ "Modified (comment): / 29-08-2017 / 14:53:20 / cg"
! !
!Depth1Image methodsFor:'magnification'!