Rewrote bitmap conversion routines.

Bitmap is weird.