how to color mask in c

后端 未结 4 947
自闭症患者
自闭症患者 2021-01-26 04:32

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)

4条回答
  •  萌比男神i
    2021-01-26 05:15

    This should get you the result you want:

    short red = (color >> 16) & 0xFF;
    short green = (color >> 8) & 0xFF;
    short blue = (color) & 0xFF;
    

提交回复
热议问题