Since you force yourself to 565 Graphics::ColorMask and Graphics::RGBToColor can be of use here too.