----------------------------------------------------------------------
()
| 3145 | |
| 3146 | //---------------------------------------------------------------------- |
| 3147 | public function next() |
| 3148 | { |
| 3149 | do { |
| 3150 | |
| 3151 | if($this->bit == -1) { |
| 3152 | $this->bit = 0; |
| 3153 | return array('x'=>$this->x, 'y'=>$this->y); |
| 3154 | } |
| 3155 | |
| 3156 | $x = $this->x; |
| 3157 | $y = $this->y; |
| 3158 | $w = $this->width; |
| 3159 | |
| 3160 | if($this->bit == 0) { |
| 3161 | $x--; |
| 3162 | $this->bit++; |
| 3163 | } else { |
| 3164 | $x++; |
| 3165 | $y += $this->dir; |
| 3166 | $this->bit--; |
| 3167 | } |
| 3168 | |
| 3169 | if($this->dir < 0) { |
| 3170 | if($y < 0) { |
| 3171 | $y = 0; |
| 3172 | $x -= 2; |
| 3173 | $this->dir = 1; |
| 3174 | if($x == 6) { |
| 3175 | $x--; |
| 3176 | $y = 9; |
| 3177 | } |
| 3178 | } |
| 3179 | } else { |
| 3180 | if($y == $w) { |
| 3181 | $y = $w - 1; |
| 3182 | $x -= 2; |
| 3183 | $this->dir = -1; |
| 3184 | if($x == 6) { |
| 3185 | $x--; |
| 3186 | $y -= 8; |
| 3187 | } |
| 3188 | } |
| 3189 | } |
| 3190 | if($x < 0 || $y < 0) return null; |
| 3191 | |
| 3192 | $this->x = $x; |
| 3193 | $this->y = $y; |
| 3194 | |
| 3195 | } while(ord($this->frame[$y][$x]) & 0x80); |
| 3196 | |
| 3197 | return array('x'=>$x, 'y'=>$y); |
| 3198 | } |
| 3199 | |
| 3200 | } ; |
| 3201 |