Update collision flags and some other optimizations

This is a pull request with more optimizations using bit shifts. It was done on top of the jruby-swt PR.

As I've said before I think it will still be better to have direct access to the "on/off" bits of the graphics, but this is already faster than previous version as calling graphic's `pixel` method is very expensive.