135 Notice: row coordinate starts with 0." |
135 Notice: row coordinate starts with 0." |
136 |
136 |
137 |lineIndex "{ Class: SmallInteger }" |
137 |lineIndex "{ Class: SmallInteger }" |
138 byte "{ Class: SmallInteger }" |
138 byte "{ Class: SmallInteger }" |
139 w "{ Class: SmallInteger }" |
139 w "{ Class: SmallInteger }" |
140 pixel dstIdx bytes| |
140 pixel bytes| |
141 |
141 |
142 bytes := self bits. |
142 bytes := self bits. |
143 dstIdx := 1. |
|
144 w := width - 1. |
143 w := width - 1. |
145 lineIndex := (self bytesPerRow * y). |
144 lineIndex := self bytesPerRow * y. |
146 0 to:w do:[:x | |
145 0 to:w do:[:x | |
147 x even ifTrue:[ |
146 x even ifTrue:[ |
148 lineIndex := lineIndex + 1. |
147 lineIndex := lineIndex + 1. |
149 byte := bytes at:lineIndex. |
148 byte := bytes at:lineIndex. |
150 pixel := (byte bitShift:-4) bitAnd:16rF. |
149 pixel := (byte bitShift:-4) bitAnd:16rF. |
151 ] ifFalse:[ |
150 ] ifFalse:[ |
152 pixel := byte bitAnd:16rF. |
151 pixel := byte bitAnd:16rF. |
153 ]. |
152 ]. |
154 aPixelBuffer at:dstIdx put:pixel. |
153 aPixelBuffer at:x+1 put:pixel. |
155 dstIdx := dstIdx + 1 |
154 ]. |
156 ]. |
155 |
157 |
156 "Created: / 21-07-1997 / 18:04:00 / cg" |
158 "Created: 21.7.1997 / 18:04:00 / cg" |
157 "Modified: / 30-01-2017 / 18:51:24 / stefan" |
159 "Modified: 21.7.1997 / 18:05:47 / cg" |
|
160 ! ! |
158 ! ! |
161 |
159 |
162 !Depth4Image methodsFor:'converting images'! |
160 !Depth4Image methodsFor:'converting images'! |
163 |
161 |
164 anyImageAsTrueColorFormOn:aDevice |
162 anyImageAsTrueColorFormOn:aDevice |
855 image than using valueAtX:y:, since some processing can be |
853 image than using valueAtX:y:, since some processing can be |
856 avoided when going from pixel to pixel. However, for |
854 avoided when going from pixel to pixel. However, for |
857 real image processing, specialized methods should be written." |
855 real image processing, specialized methods should be written." |
858 |
856 |
859 |srcIndex "{ Class: SmallInteger }" |
857 |srcIndex "{ Class: SmallInteger }" |
860 byte "{ Class: SmallInteger }" |
|
861 shift "{ Class: SmallInteger }" |
858 shift "{ Class: SmallInteger }" |
862 pixelValue "{ Class: SmallInteger }" |
859 pixelValue "{ Class: SmallInteger }" |
863 x1 "{ Class: SmallInteger }" |
860 x1 "{ Class: SmallInteger }" |
864 x2 "{ Class: SmallInteger }" |
861 x2 "{ Class: SmallInteger }" |
865 bytes| |
862 bytes| |
869 x1 := xLow. |
866 x1 := xLow. |
870 x2 := xHigh. |
867 x2 := xHigh. |
871 srcIndex := (self bytesPerRow * y) + 1. |
868 srcIndex := (self bytesPerRow * y) + 1. |
872 srcIndex := srcIndex + (x1 // 2). |
869 srcIndex := srcIndex + (x1 // 2). |
873 x1 even ifTrue:[ |
870 x1 even ifTrue:[ |
874 shift := -4 |
871 shift := -4 |
875 ] ifFalse:[ |
872 ] ifFalse:[ |
876 shift := 0 |
873 shift := 0 |
877 ]. |
874 ]. |
878 |
875 |
879 x1 to:x2 do:[:x | |
876 x1 to:x2 do:[:x | |
880 shift == 0 ifTrue:[ |
877 pixelValue := bytes at:srcIndex. |
881 byte := bytes at:srcIndex. |
878 shift == 0 ifTrue:[ |
882 pixelValue := byte bitAnd:16rF. |
879 shift := -4. |
883 shift := -4. |
880 srcIndex := srcIndex + 1. |
884 srcIndex := srcIndex + 1. |
881 ] ifFalse:[ |
885 ] ifFalse:[ |
882 pixelValue := pixelValue bitShift:-4. |
886 byte := bytes at:srcIndex. |
883 shift := 0 |
887 pixelValue := (byte bitShift:-4) bitAnd:16rF. |
884 ]. |
888 shift := 0 |
885 aBlock value:x value:(pixelValue bitAnd:16rF). |
889 ]. |
|
890 aBlock value:x value:pixelValue. |
|
891 ] |
886 ] |
892 |
887 |
893 "Created: 7.6.1996 / 19:09:45 / cg" |
888 "Created: / 07-06-1996 / 19:09:45 / cg" |
|
889 "Modified (format): / 30-01-2017 / 20:41:31 / stefan" |
894 ! ! |
890 ! ! |
895 |
891 |
896 !Depth4Image methodsFor:'magnification'! |
892 !Depth4Image methodsFor:'magnification'! |
897 |
893 |
898 magnifyRowFrom:srcBytes offset:srcStart |
894 magnifyRowFrom:srcBytes offset:srcStart |