redo of back end

Colors now work better, supports 16bpp, 24bpp, and 32bpp formats.
Entire structure is better written.