equal
deleted
inserted
replaced
153 |
153 |
154 index := (self bytesPerRow * y) + 1 + (x // 8). |
154 index := (self bytesPerRow * y) + 1 + (x // 8). |
155 |
155 |
156 "left pixel is in high bit" |
156 "left pixel is in high bit" |
157 byte := bytes at:index. |
157 byte := bytes at:index. |
158 mask := #(16r80 16r40 16r20 16r10 16r08 16r04 16r02 16r01) at:((x \\ 8) + 1). |
158 mask := #[16r80 16r40 16r20 16r10 16r08 16r04 16r02 16r01] at:((x \\ 8) + 1). |
159 aPixelValue == 0 ifTrue:[ |
159 aPixelValue == 0 ifTrue:[ |
160 byte := byte bitAnd:(mask bitInvert) |
160 byte := byte bitAnd:(mask bitInvert) |
161 ] ifFalse:[ |
161 ] ifFalse:[ |
162 byte := byte bitOr:mask |
162 byte := byte bitOr:mask |
163 ]. |
163 ]. |
738 |
738 |
739 bits := self bits. |
739 bits := self bits. |
740 bits isEmptyOrNil ifTrue:[^ #() ]. |
740 bits isEmptyOrNil ifTrue:[^ #() ]. |
741 |
741 |
742 first := bits at:1. |
742 first := bits at:1. |
743 ((first == 0) or:[(first == 2r11111111)]) ifFalse:[ ^ #(0 1) ]. |
743 ((first == 0) or:[(first == 2r11111111)]) ifFalse:[ ^ #[0 1] ]. |
744 |
744 |
745 bits do:[:eachByte | |
745 bits do:[:eachByte | |
746 (first bitXor:eachByte) ~~ 0 ifTrue:[ |
746 (first bitXor:eachByte) ~~ 0 ifTrue:[ |
747 ^ #(0 1) |
747 ^ #[0 1] |
748 ]. |
748 ]. |
749 ]. |
749 ]. |
750 ^ first == 0 ifTrue:[ #(0) ] ifFalse:[ #(1) ]. |
750 ^ first == 0 ifTrue:[ #[0] ] ifFalse:[ #[1] ]. |
|
751 |
|
752 "Modified: / 30-01-2017 / 19:21:52 / stefan" |
751 ! |
753 ! |
752 |
754 |
753 valueFromColor:aColor |
755 valueFromColor:aColor |
754 "given a color, return the corresponding pixel value. |
756 "given a color, return the corresponding pixel value. |
755 Non-representable colors return nil." |
757 Non-representable colors return nil." |