how do you color mask a 32 bit unsigned integer for the red, green, and blue values
is it like this? (color_to_be_masked>>8)
If you cast to char or uint8_t afterwards, it works like you said.
Otherwise you need to add a &0xffas well, or you'll have the remaining bits too (for all but the most significant color). So, something like (color >> multiple_of_8) &0xff.
Important detail: There is RGBA and BGRA component ordering, and there are different endiannesses on different CPUs. You must know which one you have to get it right (e.g. Windows GDI is BGRA).