#REFACTORING by stefan
class: Depth4Image
changed:
#rowAt:into:
#valuesAtY:from:to:do:
SmallLint refactoring
--- a/Depth4Image.st Tue Jan 31 13:47:43 2017 +0100
+++ b/Depth4Image.st Tue Jan 31 13:47:54 2017 +0100
@@ -137,26 +137,24 @@
|lineIndex "{ Class: SmallInteger }"
byte "{ Class: SmallInteger }"
w "{ Class: SmallInteger }"
- pixel dstIdx bytes|
+ pixel bytes|
bytes := self bits.
- dstIdx := 1.
w := width - 1.
- lineIndex := (self bytesPerRow * y).
+ lineIndex := self bytesPerRow * y.
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
+ x even ifTrue:[
+ lineIndex := lineIndex + 1.
+ byte := bytes at:lineIndex.
+ pixel := (byte bitShift:-4) bitAnd:16rF.
+ ] ifFalse:[
+ pixel := byte bitAnd:16rF.
+ ].
+ aPixelBuffer at:x+1 put:pixel.
].
- "Created: 21.7.1997 / 18:04:00 / cg"
- "Modified: 21.7.1997 / 18:05:47 / cg"
+ "Created: / 21-07-1997 / 18:04:00 / cg"
+ "Modified: / 30-01-2017 / 18:51:24 / stefan"
! !
!Depth4Image methodsFor:'converting images'!
@@ -857,7 +855,6 @@
real image processing, specialized methods should be written."
|srcIndex "{ Class: SmallInteger }"
- byte "{ Class: SmallInteger }"
shift "{ Class: SmallInteger }"
pixelValue "{ Class: SmallInteger }"
x1 "{ Class: SmallInteger }"
@@ -871,26 +868,25 @@
srcIndex := (self bytesPerRow * y) + 1.
srcIndex := srcIndex + (x1 // 2).
x1 even ifTrue:[
- shift := -4
+ shift := -4
] ifFalse:[
- shift := 0
+ shift := 0
].
x1 to:x2 do:[:x |
- shift == 0 ifTrue:[
- byte := bytes at:srcIndex.
- pixelValue := byte bitAnd:16rF.
- shift := -4.
- srcIndex := srcIndex + 1.
- ] ifFalse:[
- byte := bytes at:srcIndex.
- pixelValue := (byte bitShift:-4) bitAnd:16rF.
- shift := 0
- ].
- aBlock value:x value:pixelValue.
+ pixelValue := bytes at:srcIndex.
+ shift == 0 ifTrue:[
+ shift := -4.
+ srcIndex := srcIndex + 1.
+ ] ifFalse:[
+ pixelValue := pixelValue bitShift:-4.
+ shift := 0
+ ].
+ aBlock value:x value:(pixelValue bitAnd:16rF).
]
- "Created: 7.6.1996 / 19:09:45 / cg"
+ "Created: / 07-06-1996 / 19:09:45 / cg"
+ "Modified (format): / 30-01-2017 / 20:41:31 / stefan"
! !
!Depth4Image methodsFor:'magnification'!